1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 12:23:53 +00:00

Gather external IP stats (no range limit case).

This commit is contained in:
Bartosz Taudul 2021-04-18 19:04:29 +02:00
parent 8db9bcf7f8
commit c5eb398319
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -3169,6 +3169,7 @@ void SourceView::SelectAsmLinesHover( uint32_t file, uint32_t line, const Worker
void SourceView::GatherIpStats( uint64_t addr, AddrStat& iptotalSrc, AddrStat& iptotalAsm, unordered_flat_map<uint64_t, AddrStat>& ipcountSrc, unordered_flat_map<uint64_t, AddrStat>& ipcountAsm, AddrStat& ipmaxSrc, AddrStat& ipmaxAsm, const Worker& worker, bool limitView, const View& view ) void SourceView::GatherIpStats( uint64_t addr, AddrStat& iptotalSrc, AddrStat& iptotalAsm, unordered_flat_map<uint64_t, AddrStat>& ipcountSrc, unordered_flat_map<uint64_t, AddrStat>& ipcountAsm, AddrStat& ipmaxSrc, AddrStat& ipmaxAsm, const Worker& worker, bool limitView, const View& view )
{ {
const auto slzReady = worker.AreSourceLocationZonesReady();
auto filename = m_source.filename(); auto filename = m_source.filename();
if( limitView ) if( limitView )
{ {
@ -3232,6 +3233,16 @@ void SourceView::GatherIpStats( uint64_t addr, AddrStat& iptotalSrc, AddrStat& i
if( !ipmap ) return; if( !ipmap ) return;
for( auto& ip : *ipmap ) for( auto& ip : *ipmap )
{ {
auto addr = worker.GetCanonicalPointer( ip.first );
assert( ipcountAsm.find( addr ) == ipcountAsm.end() );
auto cp = slzReady ? worker.GetChildSamples( addr ) : nullptr;
const uint32_t ccnt = cp ? (uint32_t)cp->size() : 0;
ipcountAsm.emplace( addr, AddrStat { ip.second, ccnt } );
iptotalAsm.local += ip.second;
iptotalAsm.ext += ccnt;
if( ipmaxAsm.local < ip.second ) ipmaxAsm.local = ip.second;
if( ipmaxAsm.ext < ccnt ) ipmaxAsm.ext = ccnt;
if( filename ) if( filename )
{ {
auto frame = worker.GetCallstackFrame( ip.first ); auto frame = worker.GetCallstackFrame( ip.first );
@ -3246,26 +3257,25 @@ void SourceView::GatherIpStats( uint64_t addr, AddrStat& iptotalSrc, AddrStat& i
auto it = ipcountSrc.find( line ); auto it = ipcountSrc.find( line );
if( it == ipcountSrc.end() ) if( it == ipcountSrc.end() )
{ {
ipcountSrc.emplace( line, AddrStat{ ip.second, 0 } ); ipcountSrc.emplace( line, AddrStat{ ip.second, ccnt } );
if( ipmaxSrc.local < ip.second ) ipmaxSrc.local = ip.second; if( ipmaxSrc.local < ip.second ) ipmaxSrc.local = ip.second;
if( ipmaxSrc.ext < ccnt ) ipmaxSrc.ext = ccnt;
} }
else else
{ {
const auto sum = it->second.local + ip.second; const auto sum = it->second.local + ip.second;
const auto csum = it->second.ext + ccnt;
it->second.local = sum; it->second.local = sum;
it->second.ext = csum;
if( ipmaxSrc.local < sum ) ipmaxSrc.local = sum; if( ipmaxSrc.local < sum ) ipmaxSrc.local = sum;
if( ipmaxSrc.ext < csum ) ipmaxSrc.ext = csum;
} }
iptotalSrc.local += ip.second; iptotalSrc.local += ip.second;
iptotalSrc.ext += ccnt;
} }
} }
} }
} }
auto addr = worker.GetCanonicalPointer( ip.first );
assert( ipcountAsm.find( addr ) == ipcountAsm.end() );
ipcountAsm.emplace( addr, AddrStat { ip.second, 0 } );
iptotalAsm.local += ip.second;
if( ipmaxAsm.local < ip.second ) ipmaxAsm.local = ip.second;
} }
} }
} }