Shorten frame names in sample statistics view.

This commit is contained in:
Bartosz Taudul 2022-08-15 19:56:17 +02:00
parent 4d0591cf2f
commit 6932eb4b79
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -297,25 +297,53 @@ void View::DrawSamplesStatistics( Vector<SymList>& data, int64_t timeRange, Accu
{ {
TextColoredUnformatted( 0xFF8888FF, name ); TextColoredUnformatted( 0xFF8888FF, name );
} }
else else if( m_shortenName == ShortenName::Never )
{ {
ImGui::TextUnformatted( name ); ImGui::TextUnformatted( name );
} }
else
{
const auto normalized = ShortenZoneName( ShortenName::OnlyNormalize, name );
ImGui::TextUnformatted( normalized );
TooltipNormalizedName( name, normalized );
}
} }
else else
{ {
ImGui::PushID( idx++ ); ImGui::PushID( idx++ );
if( isKernel ) ImGui::PushStyleColor( ImGuiCol_Text, 0xFF8888FF ); bool clicked;
const auto clicked = ImGui::Selectable( name, m_sampleParents.withInlines && m_sampleParents.symAddr == v.symAddr, ImGuiSelectableFlags_SpanAllColumns ); if( isKernel )
if( isKernel ) ImGui::PopStyleColor(); {
ImGui::PushStyleColor( ImGuiCol_Text, 0xFF8888FF );
clicked = ImGui::Selectable( name, m_sampleParents.withInlines && m_sampleParents.symAddr == v.symAddr, ImGuiSelectableFlags_SpanAllColumns );
ImGui::PopStyleColor();
}
else if( m_shortenName == ShortenName::Never )
{
clicked = ImGui::Selectable( name, m_sampleParents.withInlines && m_sampleParents.symAddr == v.symAddr, ImGuiSelectableFlags_SpanAllColumns );
}
else
{
const auto normalized = ShortenZoneName( ShortenName::OnlyNormalize, name );
clicked = ImGui::Selectable( normalized, m_sampleParents.withInlines && m_sampleParents.symAddr == v.symAddr, ImGuiSelectableFlags_SpanAllColumns );
TooltipNormalizedName( name, normalized );
}
if( clicked ) ShowSampleParents( v.symAddr, !m_statSeparateInlines ); if( clicked ) ShowSampleParents( v.symAddr, !m_statSeparateInlines );
ImGui::PopID(); ImGui::PopID();
} }
if( parentName ) if( parentName )
{ {
ImGui::SameLine(); ImGui::SameLine();
if( m_shortenName == ShortenName::Never )
{
ImGui::TextDisabled( "(%s)", parentName ); ImGui::TextDisabled( "(%s)", parentName );
} }
else
{
const auto normalized = ShortenZoneName( ShortenName::OnlyNormalize, parentName );
ImGui::TextDisabled( "(%s)", normalized );
}
}
if( !m_statSeparateInlines && v.count > 0 && v.symAddr != 0 ) if( !m_statSeparateInlines && v.count > 0 && v.symAddr != 0 )
{ {
ImGui::SameLine(); ImGui::SameLine();
@ -482,16 +510,33 @@ void View::DrawSamplesStatistics( Vector<SymList>& data, int64_t timeRange, Accu
const auto sn = iv.symAddr == v.symAddr ? "[ - self - ]" : name; const auto sn = iv.symAddr == v.symAddr ? "[ - self - ]" : name;
if( iv.excl == 0 ) if( iv.excl == 0 )
{
if( m_shortenName == ShortenName::Never )
{ {
ImGui::TextUnformatted( sn ); ImGui::TextUnformatted( sn );
} }
else else
{ {
ImGui::PushID( idx++ ); const auto normalized = ShortenZoneName( ShortenName::OnlyNormalize, sn );
if( ImGui::Selectable( sn, !m_sampleParents.withInlines && m_sampleParents.symAddr == iv.symAddr, ImGuiSelectableFlags_SpanAllColumns ) ) ImGui::TextUnformatted( normalized );
{ TooltipNormalizedName( sn, normalized );
ShowSampleParents( iv.symAddr, false );
} }
}
else
{
ImGui::PushID( idx++ );
bool clicked;
if( m_shortenName == ShortenName::Never )
{
clicked = ImGui::Selectable( sn, !m_sampleParents.withInlines && m_sampleParents.symAddr == iv.symAddr, ImGuiSelectableFlags_SpanAllColumns );
}
else
{
const auto normalized = ShortenZoneName( ShortenName::OnlyNormalize, sn );
clicked = ImGui::Selectable( normalized, !m_sampleParents.withInlines && m_sampleParents.symAddr == iv.symAddr, ImGuiSelectableFlags_SpanAllColumns );
TooltipNormalizedName( sn, normalized );
}
if( clicked ) ShowSampleParents( iv.symAddr, false );
ImGui::PopID(); ImGui::PopID();
} }
ImGui::TableNextColumn(); ImGui::TableNextColumn();