mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 22:44:34 +00:00
Add calculation of child stats to source view.
This commit is contained in:
parent
85f755f3f5
commit
6a7b4e6066
@ -4589,6 +4589,59 @@ void SourceView::GatherAdditionalIpStats( uint64_t baseAddr, AddrStatData& as, c
|
||||
}
|
||||
}
|
||||
|
||||
void SourceView::GatherChildStats( uint64_t baseAddr, unordered_flat_map<uint64_t, uint32_t>& map, Worker& worker, bool limitView, const View& view )
|
||||
{
|
||||
if( !worker.AreSymbolSamplesReady() ) return;
|
||||
auto sym = worker.GetSymbolData( baseAddr );
|
||||
if( !sym ) return;
|
||||
if( limitView )
|
||||
{
|
||||
for( uint64_t ip = baseAddr; ip < baseAddr + sym->size.Val(); ip++ )
|
||||
{
|
||||
auto cp = worker.GetChildSamples( ip );
|
||||
if( !cp ) continue;
|
||||
auto it = std::lower_bound( cp->begin(), cp->end(), view.m_statRange.min, [] ( const auto& lhs, const auto& rhs ) { return lhs.time.Val() < rhs; } );
|
||||
if( it == cp->end() ) continue;
|
||||
auto end = std::lower_bound( it, cp->end(), view.m_statRange.max, [] ( const auto& lhs, const auto& rhs ) { return lhs.time.Val() < rhs; } );
|
||||
while( it != end )
|
||||
{
|
||||
auto child = worker.GetSymbolForAddress( it->addr );
|
||||
auto mit = map.find( child );
|
||||
if( mit == map.end() )
|
||||
{
|
||||
map.emplace( child, 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
mit->second++;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for( uint64_t ip = baseAddr; ip < baseAddr + sym->size.Val(); ip++ )
|
||||
{
|
||||
auto cp = worker.GetChildSamples( ip );
|
||||
if( !cp ) continue;
|
||||
for( auto& s : *cp )
|
||||
{
|
||||
auto child = worker.GetSymbolForAddress( s.addr );
|
||||
auto mit = map.find( child );
|
||||
if( mit == map.end() )
|
||||
{
|
||||
map.emplace( child, 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
mit->second++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t SourceView::CountAsmIpStats( uint64_t baseAddr, const Worker& worker, bool limitView, const View& view )
|
||||
{
|
||||
if( limitView )
|
||||
|
@ -177,6 +177,8 @@ private:
|
||||
void GatherIpHwStats( AddrStatData& as, Worker& worker, const View& view, CostType cost );
|
||||
void GatherIpStats( uint64_t baseAddr, AddrStatData& as, const Worker& worker, bool limitView, const View& view );
|
||||
void GatherAdditionalIpStats( uint64_t baseAddr, AddrStatData& as, const Worker& worker, bool limitView, const View& view );
|
||||
void GatherChildStats( uint64_t baseAddr, unordered_flat_map<uint64_t, uint32_t>& vec, Worker& worker, bool limitView, const View& view );
|
||||
|
||||
uint32_t CountAsmIpStats( uint64_t baseAddr, const Worker& worker, bool limitView, const View& view );
|
||||
void CountHwStats( AddrStatData& as, Worker& worker, const View& view );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user