From 0f42dc2e4c02f324a482c87b15061e0af1ba8180 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Thu, 9 Apr 2020 02:04:22 +0200 Subject: [PATCH] Fix source-less sample count calculations. --- server/TracySourceView.cpp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp index 98b0e023..6223fe1d 100644 --- a/server/TracySourceView.cpp +++ b/server/TracySourceView.cpp @@ -473,23 +473,26 @@ void SourceView::RenderSymbolView( const Worker& worker ) { for( auto& ip : *ipmap ) { - auto frame = worker.GetCallstackFrame( ip.first ); - if( frame ) + if( m_file ) { - auto ffn = worker.GetString( frame->data[0].file ); - if( strcmp( ffn, m_file ) == 0 ) + auto frame = worker.GetCallstackFrame( ip.first ); + if( frame ) { - const auto line = frame->data[0].line; - auto it = ipcountSrc.find( line ); - if( it == ipcountSrc.end() ) + auto ffn = worker.GetString( frame->data[0].file ); + if( strcmp( ffn, m_file ) == 0 ) { - ipcountSrc.emplace( line, ip.second ); + const auto line = frame->data[0].line; + auto it = ipcountSrc.find( line ); + if( it == ipcountSrc.end() ) + { + ipcountSrc.emplace( line, ip.second ); + } + else + { + it->second += ip.second; + } + iptotalSrc += ip.second; } - else - { - it->second += ip.second; - } - iptotalSrc += ip.second; } }