Skip to content
modkitv0.2

profiler.h

#include <modkit/profiler.h>2 functions · 15 macros

Tracy profiler integration for modkit.

When MODKIT_HAS_PROFILER is enabled, these macros integrate with Tracy for real-time profiling. When disabled, they compile to nothing. Usage (C API - requires explicit begin/end): void my_function(void) { MK_PROFILE_ZONE_BEGIN(z); // Begin profiling zone // ... work ... MK_PROFILE_ZONE_END(z); // End profiling zone } void named_zone_example(void) { MK_PROFILE_ZONE_BEGIN_N(z, "Loading Assets"); // ... loading code ... MK_PROFILE_ZONE_END(z); } Build with profiler: ./scripts/build-linux.sh profiler To view profiling data, run the Tracy profiler GUI and connect to your app. Download Tracy from: https://github.com/wolfpld/tracy/releases

Functions

mk_profiler_availablefunction

bool mk_profiler_available(void)

Check if profiler is available (compiled with MODKIT_ENABLE_PROFILER).

Returns true if profiler support is compiled in

mk_profiler_connectedfunction

bool mk_profiler_connected(void)

Check whether a Tracy profiler is currently connected.

Returns true only when profiler support is compiled in and a client is connected

Macros

MK_PROFILE_ALLOCdefine

MK_PROFILE_ALLOC(ptr, size)

Constant for profile alloc.

MK_PROFILE_FRAMEdefine

MK_PROFILE_FRAME()

Constant for profile frame.

MK_PROFILE_FRAME_NAMEDdefine

MK_PROFILE_FRAME_NAMED(name)

Constant for profile frame named.

MK_PROFILE_FREEdefine

MK_PROFILE_FREE(ptr)

Constant for profile free.

MK_PROFILE_GPU_ZONEdefine

MK_PROFILE_GPU_ZONE(name)

Constant for profile GPU zone.

MK_PROFILE_GPU_ZONE_ENDdefine

MK_PROFILE_GPU_ZONE_END()

Constant for profile GPU zone end.

MK_PROFILE_MESSAGEdefine

MK_PROFILE_MESSAGE(text, len)

Constant for profile message.

MK_PROFILE_PLOTdefine

MK_PROFILE_PLOT(name, value)

Constant for profile plot.

MK_PROFILE_THREAD_NAMEdefine

MK_PROFILE_THREAD_NAME(name)

Constant for profile thread name.

MK_PROFILE_ZONE_BEGINdefine

MK_PROFILE_ZONE_BEGIN(ctx)

Constant for profile zone begin.

MK_PROFILE_ZONE_BEGIN_Ndefine

MK_PROFILE_ZONE_BEGIN_N(ctx, name)

Constant for profile zone begin n.

MK_PROFILE_ZONE_BEGIN_NCdefine

MK_PROFILE_ZONE_BEGIN_NC(ctx, name, c)

Constant for profile zone begin nc.

MK_PROFILE_ZONE_ENDdefine

MK_PROFILE_ZONE_END(ctx)

Constant for profile zone end.

MK_PROFILE_ZONE_TEXTdefine

MK_PROFILE_ZONE_TEXT(ctx, text, len)

Constant for profile zone text.

MK_PROFILE_ZONE_VALUEdefine

MK_PROFILE_ZONE_VALUE(ctx, value)

Constant for profile zone value.