From b6887f3663a5ad85253ab120390ae1c8fa81c1bc 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 0421d6eb..a4366b6d 100644 --- a/Tracy.hpp +++ b/Tracy.hpp @@ -103,6 +103,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 );