From 60f0ed8c0e1444d3c55e8d1c9267c68c39b545dd Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 9 Oct 2022 21:12:47 +0200 Subject: [PATCH] Include child calls in inline propagation. --- server/TracySourceView.cpp | 68 +++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 30 deletions(-) diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp index 91c98cfa..3451b034 100644 --- a/server/TracySourceView.cpp +++ b/server/TracySourceView.cpp @@ -5038,25 +5038,29 @@ void SourceView::GatherAdditionalIpStats( uint64_t baseAddr, AddrStatData& as, c auto frame = worker.GetCallstackFrame( worker.PackPointer( ip ) ); if( frame ) { - auto ffn = worker.GetString( frame->data[0].file ); - if( strcmp( ffn, filename ) == 0 ) + const auto end = m_propagateInlines ? frame->size : 1; + for( uint8_t i=0; idata[0].line; - if( line != 0 ) + auto ffn = worker.GetString( frame->data[i].file ); + if( strcmp( ffn, filename ) == 0 ) { - auto sit = as.ipCountSrc.find( line ); - if( sit == as.ipCountSrc.end() ) + const auto line = frame->data[i].line; + if( line != 0 ) { - as.ipCountSrc.emplace( line, AddrStat{ 0, ccnt } ); - if( as.ipMaxSrc.ext < ccnt ) as.ipMaxSrc.ext = ccnt; + auto sit = as.ipCountSrc.find( line ); + if( sit == as.ipCountSrc.end() ) + { + as.ipCountSrc.emplace( line, AddrStat{ 0, ccnt } ); + if( as.ipMaxSrc.ext < ccnt ) as.ipMaxSrc.ext = ccnt; + } + else + { + const auto csum = sit->second.ext + ccnt; + sit->second.ext = csum; + if( as.ipMaxSrc.ext < csum ) as.ipMaxSrc.ext = csum; + } + as.ipTotalSrc.ext += ccnt; } - else - { - const auto csum = sit->second.ext + ccnt; - sit->second.ext = csum; - if( as.ipMaxSrc.ext < csum ) as.ipMaxSrc.ext = csum; - } - as.ipTotalSrc.ext += ccnt; } } } @@ -5087,25 +5091,29 @@ void SourceView::GatherAdditionalIpStats( uint64_t baseAddr, AddrStatData& as, c auto frame = worker.GetCallstackFrame( worker.PackPointer( ip ) ); if( frame ) { - auto ffn = worker.GetString( frame->data[0].file ); - if( strcmp( ffn, filename ) == 0 ) + const auto end = m_propagateInlines ? frame->size : 1; + for( uint8_t i=0; idata[0].line; - if( line != 0 ) + auto ffn = worker.GetString( frame->data[i].file ); + if( strcmp( ffn, filename ) == 0 ) { - auto sit = as.ipCountSrc.find( line ); - if( sit == as.ipCountSrc.end() ) + const auto line = frame->data[i].line; + if( line != 0 ) { - as.ipCountSrc.emplace( line, AddrStat{ 0, ccnt } ); - if( as.ipMaxSrc.ext < ccnt ) as.ipMaxSrc.ext = ccnt; + auto sit = as.ipCountSrc.find( line ); + if( sit == as.ipCountSrc.end() ) + { + as.ipCountSrc.emplace( line, AddrStat{ 0, ccnt } ); + if( as.ipMaxSrc.ext < ccnt ) as.ipMaxSrc.ext = ccnt; + } + else + { + const auto csum = sit->second.ext + ccnt; + sit->second.ext = csum; + if( as.ipMaxSrc.ext < csum ) as.ipMaxSrc.ext = csum; + } + as.ipTotalSrc.ext += ccnt; } - else - { - const auto csum = sit->second.ext + ccnt; - sit->second.ext = csum; - if( as.ipMaxSrc.ext < csum ) as.ipMaxSrc.ext = csum; - } - as.ipTotalSrc.ext += ccnt; } } }