diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 37fed603..5cb944ad 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -2584,11 +2584,13 @@ void Worker::NewSourceLocation( uint64_t ptr ) Query( ServerQuerySourceLocation, ptr ); } -int16_t Worker::ShrinkSourceLocation( uint64_t srcloc ) +int16_t Worker::ShrinkSourceLocationReal( uint64_t srcloc ) { auto it = m_sourceLocationShrink.find( srcloc ); if( it != m_sourceLocationShrink.end() ) { + m_data.shrinkSrclocLast.first = srcloc; + m_data.shrinkSrclocLast.second = it->second; return it->second; } else @@ -2608,6 +2610,8 @@ int16_t Worker::NewShrinkedSourceLocation( uint64_t srcloc ) m_data.sourceLocationZonesCnt.emplace( sz, 0 ); #endif m_sourceLocationShrink.emplace( srcloc, sz ); + m_data.shrinkSrclocLast.first = srcloc; + m_data.shrinkSrclocLast.second = sz; return sz; } diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index 092e465f..0678a2ec 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -215,6 +215,7 @@ private: std::pair threadDataLast = std::make_pair( std::numeric_limits::max(), nullptr ); std::pair ctxSwitchLast = std::make_pair( std::numeric_limits::max(), nullptr ); uint64_t checkSrclocLast = 0; + std::pair shrinkSrclocLast = std::make_pair( std::numeric_limits::max(), 0 ); }; struct MbpsBlock @@ -469,7 +470,12 @@ private: tracy_force_inline void CheckSourceLocation( uint64_t ptr ); void NewSourceLocation( uint64_t ptr ); - tracy_force_inline int16_t ShrinkSourceLocation( uint64_t srcloc ); + tracy_force_inline int16_t ShrinkSourceLocation( uint64_t srcloc ) + { + if( m_data.shrinkSrclocLast.first == srcloc ) return m_data.shrinkSrclocLast.second; + return ShrinkSourceLocationReal( srcloc ); + } + int16_t ShrinkSourceLocationReal( uint64_t srcloc ); int16_t NewShrinkedSourceLocation( uint64_t srcloc ); tracy_force_inline void MemAllocChanged( int64_t time );