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

Use tables for sampled statistics menu.

This commit is contained in:
Bartosz Taudul 2020-12-09 21:36:53 +01:00
parent f14c0fe402
commit dc6893f419

View File

@ -12729,29 +12729,15 @@ void View::DrawStatistics()
} }
ImGui::BeginChild( "##statisticsSampling" ); ImGui::BeginChild( "##statisticsSampling" );
const auto w = ImGui::GetWindowWidth(); if( ImGui::BeginTable( "##statisticsSampling", 5, ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_ScrollY ) )
static bool widthSet = false;
ImGui::Columns( 5 );
if( !widthSet )
{ {
widthSet = true; ImGui::TableSetupScrollFreeze( 0, 1 );
ImGui::SetColumnWidth( 0, w * 0.31f ); ImGui::TableSetupColumn( "Name", ImGuiTableColumnFlags_NoHide );
ImGui::SetColumnWidth( 1, w * 0.4f ); ImGui::TableSetupColumn( "Location", ImGuiTableColumnFlags_NoSort );
ImGui::SetColumnWidth( 2, w * 0.115f ); ImGui::TableSetupColumn( "Image" );
ImGui::SetColumnWidth( 3, w * 0.1f ); ImGui::TableSetupColumn( m_statSampleTime ? "Time" : "Count", ImGuiTableColumnFlags_WidthAutoResize );
ImGui::SetColumnWidth( 4, w * 0.075f ); ImGui::TableSetupColumn( "Code size", ImGuiTableColumnFlags_WidthAutoResize );
} ImGui::TableHeadersRow();
ImGui::TextUnformatted( "Name" );
ImGui::NextColumn();
ImGui::TextUnformatted( "Location" );
ImGui::NextColumn();
ImGui::TextUnformatted( "Image" );
ImGui::NextColumn();
ImGui::TextUnformatted( m_statSampleTime ? "Time" : "Count" );
ImGui::NextColumn();
ImGui::TextUnformatted( "Code size" );
ImGui::NextColumn();
ImGui::Separator();
double revSampleCount100; double revSampleCount100;
if( m_statRange.active && m_worker.GetSamplingPeriod() != 0 ) if( m_statRange.active && m_worker.GetSamplingPeriod() != 0 )
@ -12821,6 +12807,9 @@ void View::DrawStatistics()
continue; continue;
} }
ImGui::TableNextRow();
ImGui::TableNextColumn();
const char* parentName = nullptr; const char* parentName = nullptr;
if( symlen == 0 ) if( symlen == 0 )
{ {
@ -12886,7 +12875,7 @@ void View::DrawStatistics()
ImGui::SameLine(); ImGui::SameLine();
ImGui::TextDisabled( "(+%s)", RealToString( v.count ) ); ImGui::TextDisabled( "(+%s)", RealToString( v.count ) );
} }
ImGui::NextColumn(); ImGui::TableNextColumn();
float indentVal = 0.f; float indentVal = 0.f;
if( m_statBuzzAnim.Match( v.symAddr ) ) if( m_statBuzzAnim.Match( v.symAddr ) )
{ {
@ -12935,9 +12924,9 @@ void View::DrawStatistics()
{ {
ImGui::Unindent( indentVal ); ImGui::Unindent( indentVal );
} }
ImGui::NextColumn(); ImGui::TableNextColumn();
TextDisabledUnformatted( imageName ); TextDisabledUnformatted( imageName );
ImGui::NextColumn(); ImGui::TableNextColumn();
if( cnt > 0 ) if( cnt > 0 )
{ {
char buf[64]; char buf[64];
@ -12955,7 +12944,7 @@ void View::DrawStatistics()
ImGui::SameLine(); ImGui::SameLine();
TextDisabledUnformatted( buf ); TextDisabledUnformatted( buf );
} }
ImGui::NextColumn(); ImGui::TableNextColumn();
if( symlen != 0 ) if( symlen != 0 )
{ {
if( m_worker.HasSymbolCode( codeAddr ) ) if( m_worker.HasSymbolCode( codeAddr ) )
@ -12970,7 +12959,6 @@ void View::DrawStatistics()
} }
TextDisabledUnformatted( MemSizeToString( symlen ) ); TextDisabledUnformatted( MemSizeToString( symlen ) );
} }
ImGui::NextColumn();
if( !m_statSeparateInlines && expand ) if( !m_statSeparateInlines && expand )
{ {
@ -13011,6 +12999,8 @@ void View::DrawStatistics()
ImGui::Indent(); ImGui::Indent();
for( auto& iv : inSymList ) for( auto& iv : inSymList )
{ {
ImGui::TableNextRow();
ImGui::TableNextColumn();
const auto cnt = m_statSelf ? iv.excl : iv.incl; const auto cnt = m_statSelf ? iv.excl : iv.incl;
if( cnt > 0 || showAll ) if( cnt > 0 || showAll )
{ {
@ -13058,7 +13048,7 @@ void View::DrawStatistics()
} }
ImGui::PopID(); ImGui::PopID();
} }
ImGui::NextColumn(); ImGui::TableNextColumn();
float indentVal = 0.f; float indentVal = 0.f;
if( m_statBuzzAnim.Match( iv.symAddr ) ) if( m_statBuzzAnim.Match( iv.symAddr ) )
{ {
@ -13107,8 +13097,8 @@ void View::DrawStatistics()
{ {
ImGui::Unindent( indentVal ); ImGui::Unindent( indentVal );
} }
ImGui::NextColumn(); ImGui::TableNextColumn();
ImGui::NextColumn(); ImGui::TableNextColumn();
if( cnt > 0 ) if( cnt > 0 )
{ {
char buf[64]; char buf[64];
@ -13126,8 +13116,6 @@ void View::DrawStatistics()
ImGui::SameLine(); ImGui::SameLine();
TextDisabledUnformatted( buf ); TextDisabledUnformatted( buf );
} }
ImGui::NextColumn();
ImGui::NextColumn();
} }
} }
ImGui::Unindent(); ImGui::Unindent();
@ -13135,7 +13123,8 @@ void View::DrawStatistics()
} }
} }
} }
ImGui::EndColumns(); ImGui::EndTable();
}
ImGui::EndChild(); ImGui::EndChild();
inlineMap.clear(); inlineMap.clear();