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