14 #ifndef __UT_Tracing_h__
15 #define __UT_Tracing_h__
27 #define TRACY_ON_DEMAND
29 #define TRACY_DELAYED_INIT
30 #define TRACY_MANUAL_LIFETIME
33 #if !defined(MAKING_STATIC)
41 #include <tracy/Tracy.hpp>
43 class UT_API utTraceControl
65 static utTraceControl &
get();
67 bool flag(Flag
f)
const
69 return m_flags & (1u <<
f);
72 uint32_t setFlag(uint32_t idx, uint32_t
val)
74 uint32_t bflag = (1u << idx);
75 m_flags = val ? (m_flags | bflag) : (m_flags & ~bflag);
86 #define utTraceFlag(F) utTraceControl::get().flag(utTraceControl::F)
95 #define utZoneScopedFlag(F) ZoneNamed( ___tracy_scoped_zone, utTraceFlag(F) )
96 #define utZoneScopedFlagN(F, name) ZoneNamedN( ___tracy_scoped_zone, name, utTraceFlag(F) )
97 #define utZoneScopedFlagS(F, depth) ZoneNamedS( ___tracy_scoped_zone, depth, utTraceFlag(F) )
98 #define utZoneScopedFlagNS(F, name, depth) ZoneNamedNS( ___tracy_scoped_zone, name, depth, utTraceFlag(F) )
99 #define utZoneScopedBool(b) ZoneNamed( ___tracy_scoped_zone, b )
102 #define utZoneScoped ZoneScoped
103 #define utZoneScopedN(name) ZoneScopedN(name)
104 #define utZoneScopedC(color) ZoneScopedC(color)
105 #define utZoneScopedNC(name,color) ZoneScopedNC(name,color)
107 #define utZoneScopedS(depth) ZoneScopedS(depth)
108 #define utZoneScopedNS(name,depth) ZoneScopedNS(name,depth)
109 #define utZoneScopedCS(color,depth) ZoneScopedCS(color,depth)
110 #define utZoneScopedNCS(name,color,depth) ZoneScopedNCS(name,color,depth)
115 #define utZoneText(txt,size) ZoneText(txt,size)
116 #define utZoneTextSH(sh) ZoneText((sh).c_str(),(sh).length())
117 #define utZoneName(name,size) ZoneName(name,size)
118 #define utZoneNameSH(sh) ZoneName((sh).c_str(),(sh).length())
119 #define utZoneColor(color) ZoneColor(color)
120 #define utZoneValue(value) ZoneValue(value)
121 #define utZoneIsActive ZoneIsActive
124 #define utFrameMark FrameMark
125 #define utFrameMarkNamed(x) FrameMarkNamed(x)
127 #define utTracePlot(name,val) TracyPlot(name,val)
129 #define utTracePlotConfigNum(name) TracyPlotConfig(name,tracy::PlotFormatType::Number)
130 #define utTracePlotConfigMem(name) TracyPlotConfig(name,tracy::PlotFormatType::Memory)
131 #define utTracePlotConfigPct(name) TracyPlotConfig(name,tracy::PlotFormatType::Percentage)
136 #define utTraceMessage(txt,size) TracyMessage(txt,size)
137 #define utTraceMessageSH(sh) TracyMessage((sh).c_str(),(sh).length())
138 #define utTraceMessageL(txt) TracyMessageL(txt)
139 #define utTraceMessageC(txt,size,color) TracyMessageC(txt,size,color)
140 #define utTraceMessageSHC(sh,color) TracyMessageC((sh).c_str(),(sh).length(),color)
141 #define utTraceMessageLC(txt,color) TracyMessageLC(txt,color)
143 #define utTraceMessageS(txt,size,depth) TracyMessageS(txt,size,depth)
144 #define utTraceMessageSHS(sh,depth) TracyMessageS((sh).c_str(),(sh).length(),depth)
145 #define utTraceMessageLS(txt,depth) TracyMessageLS(txt,depth)
146 #define utTraceMessageCS(txt,size,color,d) TracyMessageCS(txt,size,color,d)
147 #define utTraceMessageSHCS(sh,color,d) TracyMessageCS((sh).c_str(),(sh).length(),color,d)
148 #define utTraceMessageLCS(txt,color,depth) TracyMessageLCS(txt,color,depth)
150 #define utTraceMessageFlag(F,txt,size) if(utTraceFlag(F)) TracyMessage(txt,size)
151 #define utTraceMessageFlagSH(F,sh) if(utTraceFlag(F)) TracyMessage((sh).c_str(),(sh).length())
152 #define utTraceMessageFlagL(F,txt) if(utTraceFlag(F)) TracyMessageL(txt)
153 #define utTraceMessageFlagLC(F,txt,color) if(utTraceFlag(F)) TracyMessageLC(txt,color)
154 #define utTraceMessageFlagC(F,txt,size,color) if(utTraceFlag(F)) TracyMessageC(txt,size,color)
155 #define utTraceMessageFlagSHC(F,sh,color) if(utTraceFlag(F)) TracyMessageC((sh).c_str(),(sh).length(),color)
157 #define utTraceMessageFlagS(F,txt,size,depth) if(utTraceFlag(F)) TracyMessageS(txt,size,depth)
158 #define utTraceMessageFlagSHS(F,sh,depth) if(utTraceFlag(F)) TracyMessageS((sh).c_str(),(sh).length(),depth)
159 #define utTraceMessageFlagLS(F,txt,depth) if(utTraceFlag(F)) TracyMessageLS(txt,depth)
160 #define utTraceMessageFlagLCS(F,txt,color,depth) if(utTraceFlag(F)) TracyMessageLCS(txt,color,depth)
161 #define utTraceMessageFlagCS(F,txt,size,color,d) if(utTraceFlag(F)) TracyMessageCS(txt,size,color,d)
162 #define utTraceMessageFlagSHCS(F,sh,color,d) if(utTraceFlag(F)) TracyMessageCS((sh).c_str(),(sh).length(),color,d)
165 #define utTraceAlloc(ptr,size) TracyAlloc(ptr,size)
166 #define utTraceFree(ptr) TracyFree(ptr)
167 #define utTraceAllocN(ptr,size,name) TracyAllocN(ptr,size,name)
168 #define utTraceFreeN(ptr,name) TracyFreeN(ptr,name)
170 #define utTraceAllocS(ptr,size,depth) TracyAllocS(ptr, size, depth)
171 #define utTraceFreeS(ptr,depth) TracyFreeS(ptr, depth)
172 #define utTraceAllocNS(ptr,size,depth,name) TracyAllocNS(ptr, size, depth, name)
173 #define utTraceFreeNS(ptr,depth,name) TracyFreeNS(ptr, depth, name)
176 #define utTraceIsConnected TracyIsConnected
180 #define utZoneScopedNodeFlag(F, node) ZoneNamed( ___tracy_scoped_zone, utTraceFlag(F) ); \
181 if (node) utZoneNameSH(node->getName());
184 #define utZoneScopedNodeFlagP(F, node) utZoneScopedNodeFlag(F, node) \
185 if (utZoneIsActive && node && utTraceFlag(NODE_PATHS)) { \
186 UT_StringHolder ___zonetext = node->getFullPath(); \
187 utZoneTextSH(___zonetext);}
189 #define utTraceViewportDrawEvent(viewport, event) utZoneScopedFlag(VIEWPORT); \
190 if (utZoneIsActive) { \
191 utZoneNameSH(UT_StringHolder(viewport)); \
192 utZoneTextSH(UT_StringHolder(event)); }
197 #define utTraceFlag(F) false
199 #define utZoneScopedFlag(F)
200 #define utZoneScopedFlagN(F, name)
201 #define utZoneScopedFlagS(F, depth)
202 #define utZoneScopedFlagNS(F, name, depth)
203 #define utZoneScopedBool(b)
206 #define utZoneScopedN(name)
207 #define utZoneScopedC(color)
208 #define utZoneScopedNC(name,color)
210 #define utZoneScopedS(depth)
211 #define utZoneScopedNS(name,depth)
212 #define utZoneScopedCS(color,depth)
213 #define utZoneScopedNCS(name,color,depth)
215 #define utZoneText(txt,size)
216 #define utZoneTextSH(sh)
217 #define utZoneName(name,size)
218 #define utZoneNameSH(sh)
219 #define utZoneColor(color)
220 #define utZoneValue(value)
221 #define utZoneIsActive false
224 #define utFrameMarkNamed(x)
226 #define utTracePlot(name,val)
227 #define utTracePlotConfigNum(name)
228 #define utTracePlotConfigMem(name)
229 #define utTracePlotConfigPct(name)
231 #define utTraceMessage(txt,size)
232 #define utTraceMessageSH(sh)
233 #define utTraceMessageL(txt)
234 #define utTraceMessageC(txt,size,color)
235 #define utTraceMessageSHC(sh,color)
236 #define utTraceMessageLC(txt,color)
238 #define utTraceMessageS(txt,size,depth)
239 #define utTraceMessageSHS(sh,depth)
240 #define utTraceMessageLS(txt,depth)
241 #define utTraceMessageCS(txt,size,color,d)
242 #define utTraceMessageSHCS(sh,color,d)
243 #define utTraceMessageLCS(txt,color,depth)
245 #define utTraceMessageFlag(F,txt,size)
246 #define utTraceMessageFlagSH(F,sh)
247 #define utTraceMessageFlagL(F,txt)
248 #define utTraceMessageFlagLC(F,txt,color)
249 #define utTraceMessageFlagC(F,txt,size,color)
250 #define utTraceMessageFlagSHC(F,sh,color)
252 #define utTraceMessageFlagS(F,txt,size,depth)
253 #define utTraceMessageFlagSHS(F,sh,depth)
254 #define utTraceMessageFlagLS(F,txt,depth)
255 #define utTraceMessageFlagLCS(F,txt,color,depth)
256 #define utTraceMessageFlagCS(F,txt,size,color,d)
257 #define utTraceMessageFlagSHCS(F,sh,color,d)
259 #define utTraceAlloc(ptr,size)
260 #define utTraceFree(ptr)
261 #define utTraceAllocN(ptr,size,name)
262 #define utTraceFreeN(ptr,name)
264 #define utTraceAllocS(ptr,size,depth)
265 #define utTraceFreeS(ptr,depth)
266 #define utTraceAllocNS(ptr,size,depth,name)
267 #define utTraceFreeNS(ptr,depth,name)
269 #define utTraceIsConnected false
271 #define utZoneScopedNodeFlag(F, node)
272 #define utZoneScopedNodeFlagP(F, node)
274 #define utTraceViewportDrawEvent(viewport, event)
278 #endif // UT_ASSERT_H_INCLUDED