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() ) + auto istat = m_worker.GetSymbolStats( *inSym++ ); + if( !istat ) continue; + excl += istat->excl; + for( auto& v : istat->baseParents ) { - tmpss.parents.emplace( v.first, v.second ); - } - else - { - 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( m_sampleParents.sel + 1, stats->parents.size() - 1 ); + m_sampleParents.sel = std::min( 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(); } - Vectorparents.begin())> data; - data.reserve( stats->parents.size() ); - for( auto it = stats->parents.begin(); it != stats->parents.end(); ++it ) data.push_back( it ); + Vector 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();