diff --git a/server/TracyEvent.hpp b/server/TracyEvent.hpp index abd72b26..2fffac20 100644 --- a/server/TracyEvent.hpp +++ b/server/TracyEvent.hpp @@ -668,6 +668,7 @@ struct Parameter struct SymbolStats { uint32_t incl, excl; + unordered_flat_map parents; }; enum { SymbolStatsSize = sizeof( SymbolStats ) }; diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 42b8c3aa..7667a7ea 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -5334,18 +5334,16 @@ void Worker::UpdateSampleStatisticsImpl( const CallstackFrameData** frames, uint { const auto fexcl = frames[0]; const auto fxsz = fexcl->size; + const auto& frame0 = fexcl->data[0]; + auto sym0 = m_data.symbolStats.find( frame0.symAddr ); + if( sym0 == m_data.symbolStats.end() ) sym0 = m_data.symbolStats.emplace( frame0.symAddr, SymbolStats { 0, 0, unordered_flat_map() } ).first; + sym0->second.excl += count; + for( uint8_t f=1; fdata[0]; - auto sym = m_data.symbolStats.find( frame0.symAddr ); - if( sym == m_data.symbolStats.end() ) sym = m_data.symbolStats.emplace( frame0.symAddr, SymbolStats {} ).first; - sym->second.excl += count; - for( uint8_t f=1; fdata[f]; - sym = m_data.symbolStats.find( frame.symAddr ); - if( sym == m_data.symbolStats.end() ) sym = m_data.symbolStats.emplace( frame.symAddr, SymbolStats {} ).first; - sym->second.incl += count; - } + const auto& frame = fexcl->data[f]; + auto sym = m_data.symbolStats.find( frame.symAddr ); + if( sym == m_data.symbolStats.end() ) sym = m_data.symbolStats.emplace( frame.symAddr, SymbolStats { 0, 0, unordered_flat_map() } ).first; + sym->second.incl += count; } for( uint8_t c=1; cdata[f]; auto sym = m_data.symbolStats.find( frame.symAddr ); - if( sym == m_data.symbolStats.end() ) sym = m_data.symbolStats.emplace( frame.symAddr, SymbolStats {} ).first; + if( sym == m_data.symbolStats.end() ) sym = m_data.symbolStats.emplace( frame.symAddr, SymbolStats { 0, 0, unordered_flat_map() } ).first; sym->second.incl += count; } } @@ -5431,6 +5429,16 @@ void Worker::UpdateSampleStatisticsImpl( const CallstackFrameData** frames, uint idx = it->second; m_slab.Unalloc( memsize ); } + + auto sit = sym0->second.parents.find( idx ); + if( sit == sym0->second.parents.end() ) + { + sym0->second.parents.emplace( idx, 1 ); + } + else + { + sit->second++; + } } #endif