vkmEngine
1.0.0
A C++ game engine ·
vkmengine.com
Loading...
Searching...
No Matches
profiler.h
1
#pragma once
2
15
16
#ifndef VKM_PROFILER
17
#define VKM_PROFILER 0
18
#endif
19
20
#if VKM_PROFILER
21
22
// Tracy calls vsnprintf without including <cstdio>.
23
#include <cstdio>
24
25
#include <tracy/Tracy.hpp>
26
27
// __LINE__ keeps zone variable names unique, so several scopes in one block don't collide.
28
#define VKM_PROFILE_CONCAT_(a, b) a##b
29
#define VKM_PROFILE_CONCAT(a, b) VKM_PROFILE_CONCAT_(a, b)
30
31
#define PROFILE_FRAME_MARK() FrameMark
32
#define PROFILE_SCOPE(name_literal) \
33
ZoneNamedN(VKM_PROFILE_CONCAT(vkmProfileZone_, __LINE__), name_literal, true)
34
#define PROFILE_SCOPE_NAMED(name_cstr) \
35
ZoneTransientN(VKM_PROFILE_CONCAT(vkmProfileZone_, __LINE__), name_cstr, true)
36
#define PROFILE_PLOT(name_literal, value) TracyPlot(name_literal, value)
37
38
#else
39
40
// Arguments go into an unevaluated sizeof rather than dropped, so a value that exists
41
// only to be plotted raises no unused-variable warning, at no cost.
42
#define PROFILE_FRAME_MARK() ((void)0)
43
#define PROFILE_SCOPE(name_literal) ((void)sizeof(name_literal))
44
#define PROFILE_SCOPE_NAMED(name_cstr) ((void)sizeof(name_cstr))
45
#define PROFILE_PLOT(name_literal, value) ((void)sizeof(name_literal), (void)sizeof(value))
46
47
#endif
debug
profiler.h
Generated by
1.14.0