1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 12:23:53 +00:00

Add option to display top cost inlines in symbol statistics list.

This commit is contained in:
Bartosz Taudul 2024-09-24 19:37:59 +02:00
parent ae2a7c60b8
commit 2d6bcff3a6
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
3 changed files with 32 additions and 2 deletions

View File

@ -521,6 +521,7 @@ private:
bool m_statSeparateInlines = false; bool m_statSeparateInlines = false;
bool m_mergeInlines = false; bool m_mergeInlines = false;
bool m_relativeInlines = false; bool m_relativeInlines = false;
bool m_topInline = false;
bool m_statShowAddress = false; bool m_statShowAddress = false;
bool m_statShowKernel = true; bool m_statShowKernel = true;
bool m_groupChildrenLocations = false; bool m_groupChildrenLocations = false;

View File

@ -272,7 +272,7 @@ void View::DrawSamplesStatistics( Vector<SymList>& data, int64_t timeRange, Accu
} }
Vector<SymList> inSymList; Vector<SymList> inSymList;
if( !m_statSeparateInlines && !hasNoSamples && v.count > 0 && v.symAddr != 0 && expand ) if( !m_statSeparateInlines && !hasNoSamples && v.count > 0 && v.symAddr != 0 && ( expand || m_topInline ) )
{ {
assert( v.count > 0 ); assert( v.count > 0 );
assert( symlen != 0 ); assert( symlen != 0 );
@ -364,6 +364,7 @@ void View::DrawSamplesStatistics( Vector<SymList>& data, int64_t timeRange, Accu
} }
} }
const auto origName = name;
if( hasNoSamples ) if( hasNoSamples )
{ {
if( isKernel ) if( isKernel )
@ -383,6 +384,15 @@ void View::DrawSamplesStatistics( Vector<SymList>& data, int64_t timeRange, Accu
} }
else else
{ {
if( !inSymList.empty() && m_topInline )
{
const auto topName = m_worker.GetString( symMap.find( inSymList[0].symAddr )->second.name );
if( topName != name )
{
parentName = name;
name = topName;
}
}
ImGui::PushID( idx++ ); ImGui::PushID( idx++ );
bool clicked; bool clicked;
if( isKernel ) if( isKernel )
@ -552,7 +562,22 @@ void View::DrawSamplesStatistics( Vector<SymList>& data, int64_t timeRange, Accu
break; break;
} }
const auto sn = iv.symAddr == v.symAddr ? "[ - self - ]" : name; const char* sn;
if( iv.symAddr == v.symAddr )
{
if( parentName )
{
sn = parentName;
}
else
{
sn = "[ - self - ]";
}
}
else
{
sn = name;
}
if( m_mergeInlines || iv.excl == 0 ) if( m_mergeInlines || iv.excl == 0 )
{ {
if( m_vd.shortenName == ShortenName::Never ) if( m_vd.shortenName == ShortenName::Never )

View File

@ -563,6 +563,10 @@ void View::DrawStatistics()
ImGui::Spacing(); ImGui::Spacing();
ImGui::SameLine(); ImGui::SameLine();
ImGui::Checkbox( ICON_FA_LINK " Base relative", &m_relativeInlines ); ImGui::Checkbox( ICON_FA_LINK " Base relative", &m_relativeInlines );
ImGui::SameLine();
ImGui::Spacing();
ImGui::SameLine();
ImGui::Checkbox( ICON_FA_FIRE " Top inline", &m_topInline );
if( m_statSeparateInlines ) ImGui::EndDisabled(); if( m_statSeparateInlines ) ImGui::EndDisabled();
} }