diff --git a/server/TracyView.cpp b/server/TracyView.cpp index df967200..a89832d7 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -13456,7 +13456,7 @@ void View::DrawSampleParents() int bidx = 0; for( auto& entry : cs ) { - auto frameData = m_worker.GetCallstackFrame( entry ); + auto frameData = entry.custom ? m_worker.GetParentCallstackFrame( entry ) : m_worker.GetCallstackFrame( entry ); assert( frameData ); const auto fsz = frameData->size; for( uint8_t f=0; f Worker::GetFrameRange( const FrameData& fd, int64_t from, in const CallstackFrameData* Worker::GetCallstackFrame( const CallstackFrameId& ptr ) const { + assert( ptr.custom == 0 ); auto it = m_data.callstackFrameMap.find( ptr ); if( it == m_data.callstackFrameMap.end() ) { @@ -2052,6 +2053,22 @@ const CallstackFrameData* Worker::GetCallstackFrame( const CallstackFrameId& ptr } } +#ifndef TRACY_NO_STATISTICS +const CallstackFrameData* Worker::GetParentCallstackFrame( const CallstackFrameId& ptr ) const +{ + assert( ptr.custom == 1 ); + auto it = m_data.parentCallstackFrameMap.find( ptr ); + if( it == m_data.parentCallstackFrameMap.end() ) + { + return nullptr; + } + else + { + return it->second; + } +} +#endif + const SymbolData* Worker::GetSymbolData( uint64_t sym ) const { auto it = m_data.symbolMap.find( sym ); @@ -5402,7 +5419,7 @@ void Worker::UpdateSampleStatisticsImpl( const CallstackFrameData** frames, uint parentFrameId.idx = m_callstackParentNextIdx++; parentFrameId.sel = 0; parentFrameId.custom = 1; - m_data.callstackFrameMap.emplace( parentFrameId, frameData ); + m_data.parentCallstackFrameMap.emplace( parentFrameId, frameData ); m_data.revParentFrameMap.emplace( frameData, parentFrameId ); } else diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index 42afc56f..e0aa499a 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -229,6 +229,7 @@ private: #ifndef TRACY_NO_STATISTICS unordered_flat_map*, uint32_t, VarArrayHasher, VarArrayComparator> parentCallstackMap; Vector>> parentCallstackPayload; + unordered_flat_map parentCallstackFrameMap; unordered_flat_map revParentFrameMap; unordered_flat_map postponedSamples; bool newFramesWereReceived = false; @@ -407,6 +408,7 @@ public: #ifndef TRACY_NO_STATISTICS const VarArray& GetParentCallstack( uint32_t idx ) const { return *m_data.parentCallstackPayload[idx]; } + const CallstackFrameData* GetParentCallstackFrame( const CallstackFrameId& ptr ) const; #endif const CrashEvent& GetCrashEvent() const { return m_data.crashEvent; }