VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
profiler.h
Go to the documentation of this file.
1  #ifndef _NO_VRF_PROFILER_
2 /*********************************************************************************
3 ** Copyright (c) 2026 MAK Technologies, Inc.
4 ** All rights reserved.
5 *********************************************************************************/
6 
7 #pragma once
8 
10 #include <string>
11 #include <map>
12 #include <stdlib.h>
13 
24 
25 namespace makVrf
26 {
35 {
36 public:
41  static void initializeConsoleCommands();
42 
49  static void setCollectTracyStats(bool b);
50 
57  static void setCollectTracyStatsWithoutStartup(bool b);
58 
66  static void setStartupTracyWithoutCollect(bool b);
67 
71  static bool collectTracyStats();
72 
81  static int tracyModuleLevel(size_t moduleNameHash);
82 
95  static size_t addExternalModule(const std::string& Module);
96 
98  static void Shutdown();
99 
103  static unsigned int tracyCallstackDepth();
104 
110  static void setTracyCallstackDepth(unsigned int depth);
111 
113  static size_t theTerrainModuleName;
114 
116  static size_t theVrfUtilModuleName;
117 
123  static unsigned int theTracyCallstackDepth;
124 };
125 }
126 
134 #define TRACY_ENABLE
135 
138 #ifdef TRACY_ENABLE
139 
140 #include <tracy/MAKTracyDefines.h>
141 #include <tracy/Tracy.hpp>
142 #include <client/TracyProfiler.hpp>
143 
144 inline void DtZoneSetText(tracy::ScopedZone& zone, const char* text)
145 {
146  zone.Text(text, strlen(text));
147 }
148 inline void DtZoneSetText(tracy::ScopedZone& zone, const std::string& text)
149 {
150  zone.Text(text.c_str(), text.size());
151 }
152 
159 #define DtPROFILEzone \
160  ZoneNamedS(___tracy_scoped_zone, makVrf::DtProfiler::tracyCallstackDepth(), makVrf::DtProfiler::collectTracyStats());
161 
167 #define DtPROFILE(name) \
168  ZoneNamedNS( \
169  ___tracy_scoped_zone, name, makVrf::DtProfiler::tracyCallstackDepth(), makVrf::DtProfiler::collectTracyStats());
170 
175 #define DtPROFILEC(name, color) \
176  ZoneNamedNCS(___tracy_scoped_zone, name, color, makVrf::DtProfiler::tracyCallstackDepth(), \
177  makVrf::DtProfiler::collectTracyStats());
178 
190 #define DtPROFILELEVEL(name, moduleName, level) \
191  ZoneNamedNS(___tracy_scoped_zone, name, makVrf::DtProfiler::tracyCallstackDepth(), \
192  (makVrf::DtProfiler::collectTracyStats() && (makVrf::DtProfiler::tracyModuleLevel(moduleName) >= level)));
193 
200 #define DtPROFILELEVELC(name, color, moduleName, level) \
201  ZoneNamedNCS(___tracy_scoped_zone, name, color, makVrf::DtProfiler::tracyCallstackDepth(), \
202  (makVrf::DtProfiler::collectTracyStats() && (makVrf::DtProfiler::tracyModuleLevel(moduleName) >= level)));
203 
211 #define DtPROFILE_SECTION(name) \
212  { \
213  ZoneNamedNS(___tracy_scoped_zone, name, makVrf::DtProfiler::tracyCallstackDepth(), \
214  makVrf::DtProfiler::collectTracyStats());
215 
219 #define DtPROFILE_ZONE_TEXT(text) DtZoneSetText(___tracy_scoped_zone, text)
220 
222 #define DtPROFILE_SECTION_END }
223 
225 #define DtVRF_PROFILE(name) DtPROFILE(name)
226 
228 #define DtVRF_PROFILE_FILE(name) DtPROFILE(name)
229 
234 #define DtProfilerFrameMark \
235  if (makVrf::DtProfiler::collectTracyStats()) \
236  { \
237  FrameMark; \
238  }
239 
244 #define DtProfilerPlot(x, y) TracyPlot(x, y)
245 
249 #define DtProfilerThreadName(name) tracy::SetThreadName(name);
250 
255 #define DtProfilerMessage(str, stringLen) TracyMessage(str, stringLen)
256 
259 #else
260 #define DtProfilerFrameMark
261 #define DtPROFILEzone
262 #define DtPROFILE(name)
263 #define DtPROFILEC(name, color)
264 #define DtPROFILE_SECTION(name)
265 #define DtPROFILE_SECTION_END
266 #define DtVRF_PROFILE(name)
267 #define DtVRF_PROFILE_FILE(name)
268 #endif
269 #endif
void DtZoneSetText(tracy::ScopedZone &zone, const char *text)
tracy
Definition: profiler.h:144
static unsigned int theTracyCallstackDepth
Current callstack capture depth applied to recorded zones.
Definition: profiler.h:123
static size_t theVrfUtilModuleName
Hash of the &quot;vrfutil&quot; module name, for use with the leveled markers.
Definition: profiler.h:116
IMGUI_API void Shutdown(ImGuiContext *context)
Static facade controlling the Tracy performance profiler in VR-Forces.
Definition: profiler.h:34
#define DT_DLL_vrfutil
This file is used to determine how to build Disable inconsistent dll linkage warning Visual Studio 6...
Definition: vrfutilDefines.h:34
static size_t theTerrainModuleName
Hash of the &quot;terrain&quot; module name, for use with the leveled markers.
Definition: profiler.h:113

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)