From 2e3241ba544e5332dfe3aa6ab03a5336a65e41a4 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 19 Jun 2021 20:50:06 +0200 Subject: [PATCH] Restrict hardware samples to inline function context. --- server/TracySourceView.cpp | 49 ++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp index 52afa3d0..df572046 100644 --- a/server/TracySourceView.cpp +++ b/server/TracySourceView.cpp @@ -2567,30 +2567,33 @@ void SourceView::RenderLine( const Tokenizer::Line& line, int lineNum, const Add { if( addr >= m_baseAddr && addr < m_baseAddr + m_codeLen ) { - match++; - const auto hw = worker->GetHwSampleData( addr ); - if( hw ) + if( !m_calcInlineStats || worker->GetInlineSymbolForAddress( addr ) == m_symAddr ) { - hasHwData = true; - auto& statRange = view->m_statRange; - if( statRange.active ) + match++; + const auto hw = worker->GetHwSampleData( addr ); + if( hw ) { - hw->sort(); - cycles += CountHwSamples( hw->cycles, statRange ); - retired += CountHwSamples( hw->retired, statRange ); - cacheRef += CountHwSamples( hw->cacheRef, statRange ); - cacheMiss += CountHwSamples( hw->cacheMiss, statRange ); - branchRetired += CountHwSamples( hw->branchRetired, statRange ); - branchMiss += CountHwSamples( hw->branchMiss, statRange ); - } - else - { - cycles += hw->cycles.size(); - retired += hw->retired.size(); - cacheRef += hw->cacheRef.size(); - cacheMiss += hw->cacheMiss.size(); - branchRetired += hw->branchRetired.size(); - branchMiss += hw->branchMiss.size(); + hasHwData = true; + auto& statRange = view->m_statRange; + if( statRange.active ) + { + hw->sort(); + cycles += CountHwSamples( hw->cycles, statRange ); + retired += CountHwSamples( hw->retired, statRange ); + cacheRef += CountHwSamples( hw->cacheRef, statRange ); + cacheMiss += CountHwSamples( hw->cacheMiss, statRange ); + branchRetired += CountHwSamples( hw->branchRetired, statRange ); + branchMiss += CountHwSamples( hw->branchMiss, statRange ); + } + else + { + cycles += hw->cycles.size(); + retired += hw->retired.size(); + cacheRef += hw->cacheRef.size(); + cacheMiss += hw->cacheMiss.size(); + branchRetired += hw->branchRetired.size(); + branchMiss += hw->branchMiss.size(); + } } } } @@ -2830,7 +2833,7 @@ void SourceView::RenderAsmLine( AsmLine& line, const AddrStat& ipcnt, const Addr const auto hw = worker.GetHwSampleData( line.addr ); size_t cycles = 0, retired = 0, cacheRef = 0, cacheMiss = 0, branchRetired = 0, branchMiss = 0; - if( hw ) + if( hw && ( !m_calcInlineStats || worker.GetInlineSymbolForAddress( line.addr ) == m_symAddr ) ) { if( view.m_statRange.active ) {