Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/wolfpld/tracy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Taudul <wolf@nereid.pl>2021-11-27 19:55:18 +0300
committerBartosz Taudul <wolf@nereid.pl>2021-11-27 19:55:18 +0300
commit582fcd55386bc63537c7a4fdf03c0138459db2f8 (patch)
treeb6f892a684530be92bb52f6ed1334e7684ee1642
parentd8a611e9526536adfb6accf6db0b6113bb5a5a20 (diff)
Fix sample parents for the whole symbol.
Previously when whole symbol was selected, it wasn't. All the inlines were ignored and the data was displayed only for the base (self) symbol.
-rw-r--r--server/TracyView.cpp60
1 files changed, 28 insertions, 32 deletions
diff --git a/server/TracyView.cpp b/server/TracyView.cpp
index 6b3d6fb8..bad7df46 100644
--- a/server/TracyView.cpp
+++ b/server/TracyView.cpp
@@ -16105,43 +16105,39 @@ void View::DrawSampleParents()
ImGui::Begin( "Sample entry call stacks", &show, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse );
if( !ImGui::GetCurrentWindowRead()->SkipItems )
{
- const SymbolStats* stats;
- SymbolStats tmpss;
+ auto ss = m_worker.GetSymbolStats( m_sampleParents.symAddr );
+ auto excl = ss->excl;
+ auto stats = ss->parents;
const auto symbol = m_worker.GetSymbolData( m_sampleParents.symAddr );
- if( symbol->isInline || !m_sampleParents.withInlines )
+ if( !symbol->isInline && m_sampleParents.withInlines )
{
- stats = m_worker.GetSymbolStats( m_sampleParents.symAddr );
- }
- else
- {
- tmpss = *m_worker.GetSymbolStats( m_sampleParents.symAddr );
const auto symlen = symbol->size.Val();
auto inSym = m_worker.GetInlineSymbolList( m_sampleParents.symAddr, symlen );
- assert( inSym != nullptr );
- const auto symEnd = m_sampleParents.symAddr + symlen;
- while( *inSym < symEnd )
+ if( inSym )
{
- auto istat = m_worker.GetSymbolStats( *inSym++ );
- if( !istat ) continue;
- tmpss.incl += istat->incl;
- tmpss.excl += istat->excl;
- for( auto& v : istat->parents )
+ const auto symEnd = m_sampleParents.symAddr + symlen;
+ while( *inSym < symEnd )
{
- auto it = tmpss.parents.find( v.first );
- if( it == tmpss.parents.end() )
- {
- tmpss.parents.emplace( v.first, v.second );
- }
- else
+ auto istat = m_worker.GetSymbolStats( *inSym++ );
+ if( !istat ) continue;
+ excl += istat->excl;
+ for( auto& v : istat->baseParents )
{
- it->second += v.second;
+ auto it = stats.find( v.first );
+ if( it == stats.end() )
+ {
+ stats.emplace( v.first, v.second );
+ }
+ else
+ {
+ it->second += v.second;
+ }
}
}
}
- stats = &tmpss;
}
- assert( !stats->parents.empty() );
+ assert( !stats.empty() );
ImGui::PushFont( m_bigFont );
TextFocused( "Symbol:", m_worker.GetString( symbol->name ) );
@@ -16184,30 +16180,30 @@ void View::DrawSampleParents()
m_sampleParents.sel = std::max( m_sampleParents.sel - 1, 0 );
}
ImGui::SameLine();
- ImGui::Text( "%s / %s", RealToString( m_sampleParents.sel + 1 ), RealToString( stats->parents.size() ) );
+ ImGui::Text( "%s / %s", RealToString( m_sampleParents.sel + 1 ), RealToString( stats.size() ) );
if( ImGui::IsItemClicked() ) ImGui::OpenPopup( "EntryCallStackPopup" );
ImGui::SameLine();
if( ImGui::SmallButton( " " ICON_FA_CARET_RIGHT " " ) )
{
- m_sampleParents.sel = std::min<int>( m_sampleParents.sel + 1, stats->parents.size() - 1 );
+ m_sampleParents.sel = std::min<int>( m_sampleParents.sel + 1, stats.size() - 1 );
}
if( ImGui::BeginPopup( "EntryCallStackPopup" ) )
{
int sel = m_sampleParents.sel + 1;
ImGui::SetNextItemWidth( 120 * scale );
const bool clicked = ImGui::InputInt( "##entryCallStack", &sel, 1, 100, ImGuiInputTextFlags_EnterReturnsTrue );
- if( clicked ) m_sampleParents.sel = std::min( std::max( sel, 1 ), int( stats->parents.size() ) ) - 1;
+ if( clicked ) m_sampleParents.sel = std::min( std::max( sel, 1 ), int( stats.size() ) ) - 1;
ImGui::EndPopup();
}
- Vector<decltype(stats->parents.begin())> data;
- data.reserve( stats->parents.size() );
- for( auto it = stats->parents.begin(); it != stats->parents.end(); ++it ) data.push_back( it );
+ Vector<decltype(stats.begin())> data;
+ data.reserve( stats.size() );
+ for( auto it = stats.begin(); it != stats.end(); ++it ) data.push_back( it );
pdqsort_branchless( data.begin(), data.end(), []( const auto& l, const auto& r ) { return l->second > r->second; } );
ImGui::SameLine();
ImGui::TextUnformatted( m_statSampleTime ? TimeToString( m_worker.GetSamplingPeriod() * data[m_sampleParents.sel]->second ) : RealToString( data[m_sampleParents.sel]->second ) );
ImGui::SameLine();
char buf[64];
- PrintStringPercent( buf, 100. * data[m_sampleParents.sel]->second / stats->excl );
+ PrintStringPercent( buf, 100. * data[m_sampleParents.sel]->second / excl );
TextDisabledUnformatted( buf );
ImGui::SameLine();
ImGui::Spacing();