From 9ca254307a3ed1f6dfaa8de62aedcc479aef3076 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Mon, 24 Jun 2019 21:03:05 +0200 Subject: [PATCH] Add callstack versions of C API macros. --- TracyC.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/TracyC.h b/TracyC.h index aa3191c5..8178341a 100644 --- a/TracyC.h +++ b/TracyC.h @@ -125,6 +125,17 @@ void ___tracy_emit_messageLC( const char* txt, uint32_t color ); #define TracyCMessageC( txt, size, color ) ___tracy_emit_messageC( txt, size, color ); #define TracyCMessageLC( txt, color ) ___tracy_emit_messageLC( txt, color ); + +#ifdef TRACY_HAS_CALLSTACK +# define TracyCZoneS( ctx, depth, active ) static const struct ___tracy_source_location_data TracyConcat(__tracy_source_location,__LINE__) = { NULL, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; TracyCZoneCtx ctx = ___tracy_emit_zone_begin_callstack( &TracyConcat(__tracy_source_location,__LINE__), depth, active ); +# define TracyCZoneNS( ctx, name, depth, active ) static const struct ___tracy_source_location_data TracyConcat(__tracy_source_location,__LINE__) = { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; TracyCZoneCtx ctx = ___tracy_emit_zone_begin_callstack( &TracyConcat(__tracy_source_location,__LINE__), depth, active ); +# define TracyCZoneCS( ctx, color, depth, active ) static const struct ___tracy_source_location_data TracyConcat(__tracy_source_location,__LINE__) = { NULL, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; TracyCZoneCtx ctx = ___tracy_emit_zone_begin_callstack( &TracyConcat(__tracy_source_location,__LINE__), depth, active ); +# define TracyCZoneNCS( ctx, name, color, depth, active ) static const struct ___tracy_source_location_data TracyConcat(__tracy_source_location,__LINE__) = { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; TracyCZoneCtx ctx = ___tracy_emit_zone_begin_callstack( &TracyConcat(__tracy_source_location,__LINE__), depth, active ); + +# define TracyCAllocS( ptr, size, depth ) ___tracy_emit_memory_alloc_callstack( ptr, size, depth ) +# define TracyCFreeS( ptr, depth ) ___tracy_emit_memory_alloc_free_callstack( ptr, depth ) +#endif + #endif #ifdef __cplusplus