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

Propagate inlines for hw sample impact.

This commit is contained in:
Bartosz Taudul 2022-10-15 00:39:25 +02:00
parent e7da2efdd1
commit 47ec7de479
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -4951,28 +4951,35 @@ void SourceView::CountHwStats( AddrStatData& as, Worker& worker, const View& vie
if( filename ) if( filename )
{ {
uint32_t line; auto frame = worker.GetCallstackFrame( worker.PackPointer( addr ) );
const auto fref = worker.GetLocationForAddress( addr, line ); if( frame )
if( line != 0 )
{ {
auto ffn = worker.GetString( fref ); const auto end = m_propagateInlines ? frame->size : 1;
if( strcmp( ffn, filename ) == 0 ) for( uint8_t i=0; i<end; i++ )
{ {
auto it = as.hwCountSrc.find( line ); auto ffn = worker.GetString( frame->data[i].file );
if( it == as.hwCountSrc.end() ) if( strcmp( ffn, filename ) == 0 )
{ {
as.hwCountSrc.emplace( line, AddrStat{ branch, cache } ); const auto line = frame->data[i].line;
if( as.hwMaxSrc.local < branch ) as.hwMaxSrc.local = branch; if( line != 0 )
if( as.hwMaxSrc.ext < cache ) as.hwMaxSrc.ext = cache; {
} auto it = as.hwCountSrc.find( line );
else if( it == as.hwCountSrc.end() )
{ {
const auto branchSum = it->second.local + branch; as.hwCountSrc.emplace( line, AddrStat{ branch, cache } );
const auto cacheSum = it->second.ext + cache; if( as.hwMaxSrc.local < branch ) as.hwMaxSrc.local = branch;
it->second.local = branchSum; if( as.hwMaxSrc.ext < cache ) as.hwMaxSrc.ext = cache;
it->second.ext = cacheSum; }
if( as.hwMaxSrc.local < branchSum ) as.hwMaxSrc.local = branchSum; else
if( as.hwMaxSrc.ext < cacheSum ) as.hwMaxSrc.ext = cacheSum; {
const auto branchSum = it->second.local + branch;
const auto cacheSum = it->second.ext + cache;
it->second.local = branchSum;
it->second.ext = cacheSum;
if( as.hwMaxSrc.local < branchSum ) as.hwMaxSrc.local = branchSum;
if( as.hwMaxSrc.ext < cacheSum ) as.hwMaxSrc.ext = cacheSum;
}
}
} }
} }
} }