Don't retrieve connection id, if zone is not active.

This commit is contained in:
Bartosz Taudul 2020-01-25 17:21:30 +01:00
parent ced2d52043
commit 885fa16373

View File

@ -18,12 +18,14 @@ public:
tracy_force_inline ScopedZone( const SourceLocationData* srcloc, bool is_active = true ) tracy_force_inline ScopedZone( const SourceLocationData* srcloc, bool is_active = true )
#ifdef TRACY_ON_DEMAND #ifdef TRACY_ON_DEMAND
: m_active( is_active && GetProfiler().IsConnected() ) : m_active( is_active && GetProfiler().IsConnected() )
, m_connectionId( GetProfiler().ConnectionId() )
#else #else
: m_active( is_active ) : m_active( is_active )
#endif #endif
{ {
if( !m_active ) return; if( !m_active ) return;
#ifdef TRACY_ON_DEMAND
m_connectionId = GetProfiler().ConnectionId();
#endif
TracyLfqPrepare( QueueType::ZoneBegin ); TracyLfqPrepare( QueueType::ZoneBegin );
MemWrite( &item->zoneBegin.time, Profiler::GetTime() ); MemWrite( &item->zoneBegin.time, Profiler::GetTime() );
MemWrite( &item->zoneBegin.srcloc, (uint64_t)srcloc ); 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 ) tracy_force_inline ScopedZone( const SourceLocationData* srcloc, int depth, bool is_active = true )
#ifdef TRACY_ON_DEMAND #ifdef TRACY_ON_DEMAND
: m_active( is_active && GetProfiler().IsConnected() ) : m_active( is_active && GetProfiler().IsConnected() )
, m_connectionId( GetProfiler().ConnectionId() )
#else #else
: m_active( is_active ) : m_active( is_active )
#endif #endif
{ {
if( !m_active ) return; if( !m_active ) return;
#ifdef TRACY_ON_DEMAND
m_connectionId = GetProfiler().ConnectionId();
#endif
TracyLfqPrepare( QueueType::ZoneBeginCallstack ); TracyLfqPrepare( QueueType::ZoneBeginCallstack );
MemWrite( &item->zoneBegin.time, Profiler::GetTime() ); MemWrite( &item->zoneBegin.time, Profiler::GetTime() );
MemWrite( &item->zoneBegin.srcloc, (uint64_t)srcloc ); MemWrite( &item->zoneBegin.srcloc, (uint64_t)srcloc );