VR-Vantage 3.0.3 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TracyC.h
Go to the documentation of this file.
1 #ifndef __TRACYC_HPP__
2 #define __TRACYC_HPP__
3 
4 #include <stddef.h>
5 #include <stdint.h>
6 
8 #include "common/TracyApi.h"
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 TRACY_API void ___tracy_set_thread_name( const char* name );
15 
16 #define TracyCSetThreadName( name ) ___tracy_set_thread_name( name );
17 
18 
19 #ifndef TRACY_ENABLE
20 
21 typedef const void* TracyCZoneCtx;
22 
23 #define TracyCZone(c,x)
24 #define TracyCZoneN(c,x,y)
25 #define TracyCZoneC(c,x,y)
26 #define TracyCZoneNC(c,x,y,z)
27 #define TracyCZoneEnd(c)
28 #define TracyCZoneText(c,x,y)
29 #define TracyCZoneName(c,x,y)
30 #define TracyCZoneColor(c,x)
31 #define TracyCZoneValue(c,x)
32 
33 #define TracyCAlloc(x,y)
34 #define TracyCFree(x)
35 #define TracyCSecureAlloc(x,y)
36 #define TracyCSecureFree(x)
37 
38 #define TracyCAllocN(x,y,z)
39 #define TracyCFreeN(x,y)
40 #define TracyCSecureAllocN(x,y,z)
41 #define TracyCSecureFreeN(x,y)
42 
43 #define TracyCFrameMark
44 #define TracyCFrameMarkNamed(x)
45 #define TracyCFrameMarkStart(x)
46 #define TracyCFrameMarkEnd(x)
47 #define TracyCFrameImage(x,y,z,w,a)
48 
49 #define TracyCPlot(x,y)
50 #define TracyCMessage(x,y)
51 #define TracyCMessageL(x)
52 #define TracyCMessageC(x,y,z)
53 #define TracyCMessageLC(x,y)
54 #define TracyCAppInfo(x,y)
55 
56 #define TracyCZoneS(x,y,z)
57 #define TracyCZoneNS(x,y,z,w)
58 #define TracyCZoneCS(x,y,z,w)
59 #define TracyCZoneNCS(x,y,z,w,a)
60 
61 #define TracyCAllocS(x,y,z)
62 #define TracyCFreeS(x,y)
63 #define TracyCSecureAllocS(x,y,z)
64 #define TracyCSecureFreeS(x,y)
65 
66 #define TracyCAllocNS(x,y,z,w)
67 #define TracyCFreeNS(x,y,z)
68 #define TracyCSecureAllocNS(x,y,z,w)
69 #define TracyCSecureFreeNS(x,y,z)
70 
71 #define TracyCMessageS(x,y,z)
72 #define TracyCMessageLS(x,y)
73 #define TracyCMessageCS(x,y,z,w)
74 #define TracyCMessageLCS(x,y,z)
75 
76 #else
77 
78 #ifndef TracyConcat
79 # define TracyConcat(x,y) TracyConcatIndirect(x,y)
80 #endif
81 #ifndef TracyConcatIndirect
82 # define TracyConcatIndirect(x,y) x##y
83 #endif
84 
85 struct ___tracy_source_location_data
86 {
87  const char* name;
88  const char* function;
89  const char* file;
90  uint32_t line;
92 };
93 
94 struct ___tracy_c_zone_context
95 {
96  uint32_t id;
97  int active;
98 };
99 
100 // Some containers don't support storing const types.
101 // This struct, as visible to user, is immutable, so treat it as if const was declared here.
102 typedef /*const*/ struct ___tracy_c_zone_context TracyCZoneCtx;
103 
104 TRACY_API void ___tracy_init_thread(void);
105 TRACY_API uint64_t ___tracy_alloc_srcloc( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz );
106 TRACY_API uint64_t ___tracy_alloc_srcloc_name( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const char* name, size_t nameSz );
107 
108 TRACY_API TracyCZoneCtx ___tracy_emit_zone_begin( const struct ___tracy_source_location_data* srcloc, int active );
109 TRACY_API TracyCZoneCtx ___tracy_emit_zone_begin_callstack( const struct ___tracy_source_location_data* srcloc, int depth, int active );
110 TRACY_API TracyCZoneCtx ___tracy_emit_zone_begin_alloc( uint64_t srcloc, int active );
111 TRACY_API TracyCZoneCtx ___tracy_emit_zone_begin_alloc_callstack( uint64_t srcloc, int depth, int active );
112 TRACY_API void ___tracy_emit_zone_end( TracyCZoneCtx ctx );
113 TRACY_API void ___tracy_emit_zone_text( TracyCZoneCtx ctx, const char* txt, size_t size );
114 TRACY_API void ___tracy_emit_zone_name( TracyCZoneCtx ctx, const char* txt, size_t size );
115 TRACY_API void ___tracy_emit_zone_color( TracyCZoneCtx ctx, uint32_t color );
116 TRACY_API void ___tracy_emit_zone_value( TracyCZoneCtx ctx, uint64_t value );
117 
118 #if defined TRACY_HAS_CALLSTACK && defined TRACY_CALLSTACK
119 # define TracyCZone( ctx, active ) static const struct ___tracy_source_location_data TracyConcat(__tracy_source_location,__LINE__) = { NULL, __func__, __FILE__, (uint32_t)__LINE__, 0 }; TracyCZoneCtx ctx = ___tracy_emit_zone_begin_callstack( &TracyConcat(__tracy_source_location,__LINE__), TRACY_CALLSTACK, active );
120 # define TracyCZoneN( ctx, name, active ) static const struct ___tracy_source_location_data TracyConcat(__tracy_source_location,__LINE__) = { name, __func__, __FILE__, (uint32_t)__LINE__, 0 }; TracyCZoneCtx ctx = ___tracy_emit_zone_begin_callstack( &TracyConcat(__tracy_source_location,__LINE__), TRACY_CALLSTACK, active );
121 # define TracyCZoneC( ctx, color, active ) static const struct ___tracy_source_location_data TracyConcat(__tracy_source_location,__LINE__) = { NULL, __func__, __FILE__, (uint32_t)__LINE__, color }; TracyCZoneCtx ctx = ___tracy_emit_zone_begin_callstack( &TracyConcat(__tracy_source_location,__LINE__), TRACY_CALLSTACK, active );
122 # define TracyCZoneNC( ctx, name, color, active ) static const struct ___tracy_source_location_data TracyConcat(__tracy_source_location,__LINE__) = { name, __func__, __FILE__, (uint32_t)__LINE__, color }; TracyCZoneCtx ctx = ___tracy_emit_zone_begin_callstack( &TracyConcat(__tracy_source_location,__LINE__), TRACY_CALLSTACK, active );
123 #else
124 # define TracyCZone( ctx, active ) static const struct ___tracy_source_location_data TracyConcat(__tracy_source_location,__LINE__) = { NULL, __func__, __FILE__, (uint32_t)__LINE__, 0 }; TracyCZoneCtx ctx = ___tracy_emit_zone_begin( &TracyConcat(__tracy_source_location,__LINE__), active );
125 # define TracyCZoneN( ctx, name, active ) static const struct ___tracy_source_location_data TracyConcat(__tracy_source_location,__LINE__) = { name, __func__, __FILE__, (uint32_t)__LINE__, 0 }; TracyCZoneCtx ctx = ___tracy_emit_zone_begin( &TracyConcat(__tracy_source_location,__LINE__), active );
126 # define TracyCZoneC( ctx, color, active ) static const struct ___tracy_source_location_data TracyConcat(__tracy_source_location,__LINE__) = { NULL, __func__, __FILE__, (uint32_t)__LINE__, color }; TracyCZoneCtx ctx = ___tracy_emit_zone_begin( &TracyConcat(__tracy_source_location,__LINE__), active );
127 # define TracyCZoneNC( ctx, name, color, active ) static const struct ___tracy_source_location_data TracyConcat(__tracy_source_location,__LINE__) = { name, __func__, __FILE__, (uint32_t)__LINE__, color }; TracyCZoneCtx ctx = ___tracy_emit_zone_begin( &TracyConcat(__tracy_source_location,__LINE__), active );
128 #endif
129 
130 #define TracyCZoneEnd( ctx ) ___tracy_emit_zone_end( ctx );
131 
132 #define TracyCZoneText( ctx, txt, size ) ___tracy_emit_zone_text( ctx, txt, size );
133 #define TracyCZoneName( ctx, txt, size ) ___tracy_emit_zone_name( ctx, txt, size );
134 #define TracyCZoneColor( ctx, color ) ___tracy_emit_zone_color( ctx, color );
135 #define TracyCZoneValue( ctx, value ) ___tracy_emit_zone_value( ctx, value );
136 
137 
138 TRACY_API void ___tracy_emit_memory_alloc( const void* ptr, size_t size, int secure );
139 TRACY_API void ___tracy_emit_memory_alloc_callstack( const void* ptr, size_t size, int depth, int secure );
140 TRACY_API void ___tracy_emit_memory_free( const void* ptr, int secure );
141 TRACY_API void ___tracy_emit_memory_free_callstack( const void* ptr, int depth, int secure );
142 
143 TRACY_API void ___tracy_emit_message( const char* txt, size_t size, int callstack );
144 TRACY_API void ___tracy_emit_messageL( const char* txt, int callstack );
145 TRACY_API void ___tracy_emit_messageC( const char* txt, size_t size, uint32_t color, int callstack );
146 TRACY_API void ___tracy_emit_messageLC( const char* txt, uint32_t color, int callstack );
147 
148 #if defined TRACY_HAS_CALLSTACK && defined TRACY_CALLSTACK
149 # define TracyCAlloc( ptr, size ) ___tracy_emit_memory_alloc_callstack( ptr, size, TRACY_CALLSTACK, 0 )
150 # define TracyCFree( ptr ) ___tracy_emit_memory_free_callstack( ptr, TRACY_CALLSTACK, 0 )
151 # define TracyCSecureAlloc( ptr, size ) ___tracy_emit_memory_alloc_callstack( ptr, size, TRACY_CALLSTACK, 1 )
152 # define TracyCSecureFree( ptr ) ___tracy_emit_memory_free_callstack( ptr, TRACY_CALLSTACK, 1 )
153 
154 # define TracyCAllocN( ptr, size, name ) ___tracy_emit_memory_alloc_callstack_named( ptr, size, TRACY_CALLSTACK, 0, name )
155 # define TracyCFreeN( ptr, name ) ___tracy_emit_memory_free_callstack_named( ptr, TRACY_CALLSTACK, 0, name )
156 # define TracyCSecureAllocN( ptr, size, name ) ___tracy_emit_memory_alloc_callstack_named( ptr, size, TRACY_CALLSTACK, 1, name )
157 # define TracyCSecureFreeN( ptr, name ) ___tracy_emit_memory_free_callstack_named( ptr, TRACY_CALLSTACK, 1, name )
158 
159 # define TracyCMessage( txt, size ) ___tracy_emit_message( txt, size, TRACY_CALLSTACK );
160 # define TracyCMessageL( txt ) ___tracy_emit_messageL( txt, TRACY_CALLSTACK );
161 # define TracyCMessageC( txt, size, color ) ___tracy_emit_messageC( txt, size, color, TRACY_CALLSTACK );
162 # define TracyCMessageLC( txt, color ) ___tracy_emit_messageLC( txt, color, TRACY_CALLSTACK );
163 #else
164 # define TracyCAlloc( ptr, size ) ___tracy_emit_memory_alloc( ptr, size, 0 );
165 # define TracyCFree( ptr ) ___tracy_emit_memory_free( ptr, 0 );
166 # define TracyCSecureAlloc( ptr, size ) ___tracy_emit_memory_alloc( ptr, size, 1 );
167 # define TracyCSecureFree( ptr ) ___tracy_emit_memory_free( ptr, 1 );
168 
169 # define TracyCAllocN( ptr, size, name ) ___tracy_emit_memory_alloc_named( ptr, size, 0, name );
170 # define TracyCFreeN( ptr, name ) ___tracy_emit_memory_free_named( ptr, 0, name );
171 # define TracyCSecureAllocN( ptr, size, name ) ___tracy_emit_memory_alloc_named( ptr, size, 1, name );
172 # define TracyCSecureFreeN( ptr, name ) ___tracy_emit_memory_free_named( ptr, 1, name );
173 
174 # define TracyCMessage( txt, size ) ___tracy_emit_message( txt, size, 0 );
175 # define TracyCMessageL( txt ) ___tracy_emit_messageL( txt, 0 );
176 # define TracyCMessageC( txt, size, color ) ___tracy_emit_messageC( txt, size, color, 0 );
177 # define TracyCMessageLC( txt, color ) ___tracy_emit_messageLC( txt, color, 0 );
178 #endif
179 
180 
181 TRACY_API void ___tracy_emit_frame_mark( const char* name );
182 TRACY_API void ___tracy_emit_frame_mark_start( const char* name );
183 TRACY_API void ___tracy_emit_frame_mark_end( const char* name );
184 TRACY_API void ___tracy_emit_frame_image( const void* image, uint16_t w, uint16_t h, uint8_t offset, int flip );
185 
186 #define TracyCFrameMark ___tracy_emit_frame_mark( 0 );
187 #define TracyCFrameMarkNamed( name ) ___tracy_emit_frame_mark( name );
188 #define TracyCFrameMarkStart( name ) ___tracy_emit_frame_mark_start( name );
189 #define TracyCFrameMarkEnd( name ) ___tracy_emit_frame_mark_end( name );
190 #define TracyCFrameImage( image, width, height, offset, flip ) ___tracy_emit_frame_image( image, width, height, offset, flip );
191 
192 
193 TRACY_API void ___tracy_emit_plot( const char* name, double val );
194 TRACY_API void ___tracy_emit_message_appinfo( const char* txt, size_t size );
195 
196 #define TracyCPlot( name, val ) ___tracy_emit_plot( name, val );
197 #define TracyCAppInfo( txt, color ) ___tracy_emit_message_appinfo( txt, color );
198 
199 
200 #ifdef TRACY_HAS_CALLSTACK
201 # define TracyCZoneS( ctx, depth, active ) static const struct ___tracy_source_location_data TracyConcat(__tracy_source_location,__LINE__) = { NULL, __func__, __FILE__, (uint32_t)__LINE__, 0 }; TracyCZoneCtx ctx = ___tracy_emit_zone_begin_callstack( &TracyConcat(__tracy_source_location,__LINE__), depth, active );
202 # define TracyCZoneNS( ctx, name, depth, active ) static const struct ___tracy_source_location_data TracyConcat(__tracy_source_location,__LINE__) = { name, __func__, __FILE__, (uint32_t)__LINE__, 0 }; TracyCZoneCtx ctx = ___tracy_emit_zone_begin_callstack( &TracyConcat(__tracy_source_location,__LINE__), depth, active );
203 # define TracyCZoneCS( ctx, color, depth, active ) static const struct ___tracy_source_location_data TracyConcat(__tracy_source_location,__LINE__) = { NULL, __func__, __FILE__, (uint32_t)__LINE__, color }; TracyCZoneCtx ctx = ___tracy_emit_zone_begin_callstack( &TracyConcat(__tracy_source_location,__LINE__), depth, active );
204 # define TracyCZoneNCS( ctx, name, color, depth, active ) static const struct ___tracy_source_location_data TracyConcat(__tracy_source_location,__LINE__) = { name, __func__, __FILE__, (uint32_t)__LINE__, color }; TracyCZoneCtx ctx = ___tracy_emit_zone_begin_callstack( &TracyConcat(__tracy_source_location,__LINE__), depth, active );
205 
206 # define TracyCAllocS( ptr, size, depth ) ___tracy_emit_memory_alloc_callstack( ptr, size, depth, 0 )
207 # define TracyCFreeS( ptr, depth ) ___tracy_emit_memory_free_callstack( ptr, depth, 0 )
208 # define TracyCSecureAllocS( ptr, size, depth ) ___tracy_emit_memory_alloc_callstack( ptr, size, depth, 1 )
209 # define TracyCSecureFreeS( ptr, depth ) ___tracy_emit_memory_free_callstack( ptr, depth, 1 )
210 
211 # define TracyCAllocNS( ptr, size, depth, name ) ___tracy_emit_memory_alloc_callstack_named( ptr, size, depth, 0, name )
212 # define TracyCFreeNS( ptr, depth, name ) ___tracy_emit_memory_free_callstack_named( ptr, depth, 0, name )
213 # define TracyCSecureAllocNS( ptr, size, depth, name ) ___tracy_emit_memory_alloc_callstack_named( ptr, size, depth, 1, name )
214 # define TracyCSecureFreeNS( ptr, depth, name ) ___tracy_emit_memory_free_callstack_named( ptr, depth, 1, name )
215 
216 # define TracyCMessageS( txt, size, depth ) ___tracy_emit_message( txt, size, depth );
217 # define TracyCMessageLS( txt, depth ) ___tracy_emit_messageL( txt, depth );
218 # define TracyCMessageCS( txt, size, color, depth ) ___tracy_emit_messageC( txt, size, color, depth );
219 # define TracyCMessageLCS( txt, color, depth ) ___tracy_emit_messageLC( txt, color, depth );
220 #else
221 # define TracyCZoneS( ctx, depth, active ) TracyCZone( ctx, active )
222 # define TracyCZoneNS( ctx, name, depth, active ) TracyCZoneN( ctx, name, active )
223 # define TracyCZoneCS( ctx, color, depth, active ) TracyCZoneC( ctx, color, active )
224 # define TracyCZoneNCS( ctx, name, color, depth, active ) TracyCZoneNC( ctx, name, color, active )
225 
226 # define TracyCAllocS( ptr, size, depth ) TracyCAlloc( ptr, size )
227 # define TracyCFreeS( ptr, depth ) TracyCFree( ptr )
228 # define TracyCSecureAllocS( ptr, size, depth ) TracyCSecureAlloc( ptr, size )
229 # define TracyCSecureFreeS( ptr, depth ) TracyCSecureFree( ptr )
230 
231 # define TracyCAllocNS( ptr, size, depth, name ) TracyCAllocN( ptr, size, name )
232 # define TracyCFreeNS( ptr, depth, name ) TracyCFreeN( ptr, name )
233 # define TracyCSecureAllocNS( ptr, size, depth, name ) TracyCSecureAllocN( ptr, size, name )
234 # define TracyCSecureFreeNS( ptr, depth, name ) TracyCSecureFreeN( ptr, name )
235 
236 # define TracyCMessageS( txt, size, depth ) TracyCMessage( txt, size )
237 # define TracyCMessageLS( txt, depth ) TracyCMessageL( txt )
238 # define TracyCMessageCS( txt, size, color, depth ) TracyCMessageC( txt, size, color )
239 # define TracyCMessageLCS( txt, color, depth ) TracyCMessageLC( txt, color )
240 #endif
241 
242 #endif
243 
244 #ifdef __cplusplus
245 }
246 #endif
247 
248 #endif


Copyright © 2005-2023 MAK Technologies. All Rights Reserved (www.mak.com)