Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
Loading...
Searching...
No Matches
profiler.h
Go to the documentation of this file.
1#ifndef PROFILER_H
2#define PROFILER_H
3
4#include "gl_common.h"
5
6/* --- Tracy Toggle --- */
7// #define TRACY_ENABLE
8
9#ifdef TRACY_ENABLE
10#include "../deps/tracy/public/tracy/TracyC.h"
11
12/* Frame Mark */
13#define PROFILE_FRAME_MARK TracyCFrameMark
14
15/* CPU Zones */
16#define PROFILE_ZONE(ctx, name) TracyCZoneN(ctx, name, 1)
17#define PROFILE_ZONE_I(ctx, name) TracyCZoneN(ctx, name, 0)
18#define PROFILE_ZONE_TEXT(ctx, text, len) TracyCZoneText(ctx, text, len)
19#define PROFILE_ZONE_END(ctx) TracyCZoneEnd(ctx)
20
21/* Messaging and Threads */
22#define PROFILE_MESSAGE(text, len) TracyCMessage(text, len)
23#define PROFILE_MESSAGE_L(literal) TracyCMessageL(literal)
24#define PROFILE_MESSAGE_C(text, len, color) TracyCMessageC(text, len, color)
25#define PROFILE_THREAD_NAME(name) TracyCSetThreadName(name)
26
27/* Fibers (for async state tracking) */
28#define PROFILE_FIBER_ENTER(name) TracyCFiberEnter(name)
29#define PROFILE_FIBER_LEAVE TracyCFiberLeave
30
31#else
32/* Legacy / Dummy macros */
33#define PROFILE_FRAME_MARK ((void)0)
34
35#define PROFILE_ZONE(ctx, name) \
36 int ctx = 0; \
37 (void)(ctx); \
38 (void)(name)
39#define PROFILE_ZONE_I(ctx, name) \
40 int ctx = 0; \
41 (void)(ctx); \
42 (void)(name)
43#define PROFILE_ZONE_TEXT(ctx, text, len) \
44 ((void)(ctx), (void)(text), (void)(len))
45#define PROFILE_ZONE_END(ctx) ((void)(ctx))
46#define PROFILE_MESSAGE(text, len) ((void)(text), (void)(len))
47#define PROFILE_MESSAGE_L(literal) ((void)(literal))
48#define PROFILE_MESSAGE_C(text, len, color) \
49 ((void)(text), (void)(len), (void)(color))
50#define PROFILE_THREAD_NAME(name) ((void)(name))
51#define PROFILE_FIBER_ENTER(name) ((void)(name))
52#define PROFILE_FIBER_LEAVE ((void)0)
53#endif
54
55/* Native GPU Stages (Always on for the in-app timeline) */
56#include "gpu_profiler.h"
57#define TRACE_GPU_STAGE(profiler_ptr, name, color) \
58 GPU_STAGE_PROFILER(profiler_ptr, name, color)
59
60/* Helper for scoped GPU+CPU tracing without a profiler instance */
61#define TRACE_GPU_SCOPE(name, color) TRACE_GPU_STAGE(NULL, name, color)
62
63#endif // PROFILER_H
Common OpenGL definitions, RAII helpers, and utilities.