From 885fa16373040442cfb2674685498aec7b4287de Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 25 Jan 2020 17:21:30 +0100 Subject: [PATCH] Don't retrieve connection id, if zone is not active. --- client/TracyScoped.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/TracyScoped.hpp b/client/TracyScoped.hpp index 461b8add..0497d7ed 100644 --- a/client/TracyScoped.hpp +++ b/client/TracyScoped.hpp @@ -18,12 +18,14 @@ public: tracy_force_inline ScopedZone( const SourceLocationData* srcloc, bool is_active = true ) #ifdef TRACY_ON_DEMAND : m_active( is_active && GetProfiler().IsConnected() ) - , m_connectionId( GetProfiler().ConnectionId() ) #else : m_active( is_active ) #endif { if( !m_active ) return; +#ifdef TRACY_ON_DEMAND + m_connectionId = GetProfiler().ConnectionId(); +#endif TracyLfqPrepare( QueueType::ZoneBegin ); MemWrite( &item->zoneBegin.time, Profiler::GetTime() ); MemWrite( &item->zoneBegin.srcloc, (uint64_t)srcloc ); @@ -33,12 +35,14 @@ public: tracy_force_inline ScopedZone( const SourceLocationData* srcloc, int depth, bool is_active = true ) #ifdef TRACY_ON_DEMAND : m_active( is_active && GetProfiler().IsConnected() ) - , m_connectionId( GetProfiler().ConnectionId() ) #else : m_active( is_active ) #endif { if( !m_active ) return; +#ifdef TRACY_ON_DEMAND + m_connectionId = GetProfiler().ConnectionId(); +#endif TracyLfqPrepare( QueueType::ZoneBeginCallstack ); MemWrite( &item->zoneBegin.time, Profiler::GetTime() ); MemWrite( &item->zoneBegin.srcloc, (uint64_t)srcloc );