From bc4016e97ced105523eca2b978a65e0b68ead4c4 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 20 Jun 2021 01:01:29 +0200 Subject: [PATCH] Don't depend on callstack frames to match hw samples to source. --- server/TracySourceView.cpp | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp index 55637eec..30c5a984 100644 --- a/server/TracySourceView.cpp +++ b/server/TracySourceView.cpp @@ -4055,29 +4055,26 @@ void SourceView::GatherIpHwStats( AddrStat& iptotalSrc, AddrStat& iptotalAsm, un if( filename ) { - auto frame = worker.GetCallstackFrame( worker.PackPointer( addr ) ); - if( frame ) + uint32_t line; + const auto fref = worker.GetLocationForAddress( addr, line ); + if( line != 0 ) { - auto ffn = worker.GetString( frame->data[0].file ); + auto ffn = worker.GetString( fref ); if( strcmp( ffn, filename ) == 0 ) { - const auto line = frame->data[0].line; - if( line != 0 ) + auto it = ipcountSrc.find( line ); + if( it == ipcountSrc.end() ) { - auto it = ipcountSrc.find( line ); - if( it == ipcountSrc.end() ) - { - ipcountSrc.emplace( line, AddrStat{ stat, 0 } ); - if( ipmaxSrc.local < stat ) ipmaxSrc.local = stat; - } - else - { - const auto sum = it->second.local + stat; - it->second.local = sum; - if( ipmaxSrc.local < sum ) ipmaxSrc.local = sum; - } - iptotalSrc.local += stat; + ipcountSrc.emplace( line, AddrStat{ stat, 0 } ); + if( ipmaxSrc.local < stat ) ipmaxSrc.local = stat; } + else + { + const auto sum = it->second.local + stat; + it->second.local = sum; + if( ipmaxSrc.local < sum ) ipmaxSrc.local = sum; + } + iptotalSrc.local += stat; } } }