From aea72b28ce996223012ce861a63da88d8078dd8f Mon Sep 17 00:00:00 2001 From: Hugo Amiard Date: Fri, 7 Aug 2020 17:09:31 +0200 Subject: [PATCH] Add SourceLocation macros --- Tracy.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Tracy.hpp b/Tracy.hpp index 8d9ada59..a70497f1 100644 --- a/Tracy.hpp +++ b/Tracy.hpp @@ -105,6 +105,10 @@ #include "client/TracyProfiler.hpp" #include "client/TracyScoped.hpp" +#define TracySourceLocation( varname ) static const tracy::SourceLocationData varname { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; +#define TracySourceLocationN( varname, name ) static const tracy::SourceLocationData varname { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; +#define TracySourceLocationNC( varname, name, color ) static const tracy::SourceLocationData varname { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; + #if defined TRACY_HAS_CALLSTACK && defined TRACY_CALLSTACK # define ZoneNamed( varname, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,__LINE__) { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__), TRACY_CALLSTACK, active ); # define ZoneNamedN( varname, name, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__), TRACY_CALLSTACK, active );