diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 4cb59145..3aada30e 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -2834,16 +2834,8 @@ void Worker::NewZone( ZoneEvent* zone, uint64_t thread ) { m_data.zonesCnt++; - auto td = m_threadCtxData; - if( !td ) td = m_threadCtxData = NoticeThread( thread ); - #ifndef TRACY_NO_STATISTICS auto slz = GetSourceLocationZones( zone->SrcLoc() ); - if( !td->stack.empty() ) - { - assert( m_slzPointerMap.find( zone ) == m_slzPointerMap.end() ); - m_slzPointerMap.emplace( zone, slz->zones.size() ); - } auto& ztd = slz->zones.push_next(); ztd.SetZone( zone ); ztd.SetThread( CompressThread( thread ) ); @@ -2851,6 +2843,8 @@ void Worker::NewZone( ZoneEvent* zone, uint64_t thread ) CountZoneStatistics( zone ); #endif + auto td = m_threadCtxData; + if( !td ) td = m_threadCtxData = NoticeThread( thread ); td->count++; if( td->stack.empty() ) { @@ -3556,6 +3550,9 @@ void Worker::ProcessZoneBeginImpl( ZoneEvent* zone, const QueueZoneBegin& ev ) ZoneEvent* Worker::AllocZoneEvent() { ZoneEvent* ret; +#ifndef TRACY_NO_STATISTICS + ret = m_slab.Alloc(); +#else if( m_zoneEventPool.empty() ) { ret = m_slab.Alloc(); @@ -3564,6 +3561,7 @@ ZoneEvent* Worker::AllocZoneEvent() { ret = m_zoneEventPool.back_and_pop(); } +#endif memset( &ret->text, 0, sizeof( ZoneEvent::text ) + sizeof( ZoneEvent::callstack ) + sizeof( ZoneEvent::name ) ); return ret; } @@ -3653,6 +3651,10 @@ void Worker::ProcessZoneEnd( const QueueZoneEnd& ev ) if( sz <= 8 * 1024 ) { Vector> fitVec; +#ifndef TRACY_NO_STATISTICS + fitVec.reserve_exact( sz, m_slab ); + memcpy( fitVec.data(), childVec.data(), sz * sizeof( short_ptr ) ); +#else fitVec.set_magic(); auto& fv = *((Vector*)&fitVec); fv.reserve_exact( sz, m_slab ); @@ -3660,28 +3662,13 @@ void Worker::ProcessZoneEnd( const QueueZoneEnd& ev ) for( auto& ze : childVec ) { ZoneEvent* src = ze; -#ifndef TRACY_NO_STATISTICS - auto slz = GetSourceLocationZones( src->SrcLoc() ); - auto slzit = m_slzPointerMap.find( src ); - assert( slzit != m_slzPointerMap.end() ); - slz->zones[slzit->second].SetZone( dst ); - m_slzPointerMap.erase( slzit ); -#endif memcpy( dst++, src, sizeof( ZoneEvent ) ); m_zoneEventPool.push_back( src ); } +#endif fitVec.swap( childVec ); m_data.zoneVectorCache.push_back( std::move( fitVec ) ); } -#ifndef TRACY_NO_STATISTICS - else - { - for( auto& z : childVec ) - { - m_slzPointerMap.erase( z ); - } - } -#endif } #ifndef TRACY_NO_STATISTICS diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index 112d02d9..f262ac24 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -702,10 +702,8 @@ private: std::mutex m_netWriteLock; std::condition_variable m_netWriteCv; +#ifdef TRACY_NO_STATISTICS Vector m_zoneEventPool; - -#ifndef TRACY_NO_STATISTICS - flat_hash_map> m_slzPointerMap; #endif };