Add TracyNoop macro.

This commit is contained in:
Bartosz Taudul 2024-02-09 14:45:28 +01:00
parent 5e4eae5c2e
commit c03884d20c
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -18,6 +18,8 @@
#ifndef TRACY_ENABLE #ifndef TRACY_ENABLE
#define TracyNoop
#define ZoneNamed(x,y) #define ZoneNamed(x,y)
#define ZoneNamedN(x,y,z) #define ZoneNamedN(x,y,z)
#define ZoneNamedC(x,y,z) #define ZoneNamedC(x,y,z)
@ -123,6 +125,8 @@
#include "../client/TracyProfiler.hpp" #include "../client/TracyProfiler.hpp"
#include "../client/TracyScoped.hpp" #include "../client/TracyScoped.hpp"
#define TracyNoop tracy::ProfilerAvailable()
#if defined TRACY_HAS_CALLSTACK && defined TRACY_CALLSTACK #if defined TRACY_HAS_CALLSTACK && defined TRACY_CALLSTACK
# define ZoneNamed( varname, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,TracyLine) { nullptr, TracyFunction, TracyFile, (uint32_t)TracyLine, 0 }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,TracyLine), TRACY_CALLSTACK, active ) # define ZoneNamed( varname, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,TracyLine) { nullptr, TracyFunction, TracyFile, (uint32_t)TracyLine, 0 }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,TracyLine), TRACY_CALLSTACK, active )
# define ZoneNamedN( varname, name, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,TracyLine) { name, TracyFunction, TracyFile, (uint32_t)TracyLine, 0 }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,TracyLine), TRACY_CALLSTACK, active ) # define ZoneNamedN( varname, name, active ) static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location,TracyLine) { name, TracyFunction, TracyFile, (uint32_t)TracyLine, 0 }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,TracyLine), TRACY_CALLSTACK, active )