mirror of
https://github.com/wolfpld/tracy.git
synced 2026-10-16 05:45:26 +00:00
Show visible threads list in columns.
Options list is excluded, as that's drag-n-drop, and that's too much complication.
This commit is contained in:
@@ -509,10 +509,26 @@ void View::DrawWaitStacks()
|
||||
threadsChanged = true;
|
||||
}
|
||||
|
||||
const auto& style = ImGui::GetStyle();
|
||||
const auto cntWidth = ImGui::CalcTextSize( "(1234)" ).x;
|
||||
float probe = 0;
|
||||
for( auto& t : m_threadOrder )
|
||||
{
|
||||
if( t->ctxSwitchSamples.empty() ) continue;
|
||||
float w = ImGui::GetFrameHeight() * 2 + ImGui::CalcTextSize( m_worker.GetThreadName( t->id ) ).x + cntWidth + style.ItemSpacing.x * 3;
|
||||
if( crash.thread == t->id ) w += style.ItemSpacing.x + ImGui::CalcTextSize( ICON_FA_SKULL " Crashed" ).x;
|
||||
if( t->isFiber ) w += style.ItemSpacing.x + ImGui::CalcTextSize( "Fiber" ).x;
|
||||
probe = std::max( probe, w );
|
||||
}
|
||||
const auto MinWidth = std::max( 150 * GetScale(), probe );
|
||||
const int cols = std::max( 1, int( ImGui::GetContentRegionAvail().x / MinWidth ) );
|
||||
|
||||
int idx = 0;
|
||||
ImGui::BeginTable( "##waitstackthreadcols", cols, ImGuiTableFlags_NoSavedSettings );
|
||||
for( const auto& t : m_threadOrder )
|
||||
{
|
||||
if( t->ctxSwitchSamples.empty() ) continue;
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::PushID( idx++ );
|
||||
const auto threadColor = GetThreadColor( t->id, 0 );
|
||||
SmallColorBox( threadColor );
|
||||
@@ -535,6 +551,7 @@ void View::DrawWaitStacks()
|
||||
TextColoredUnformatted( ImVec4( 0.2f, 0.6f, 0.2f, 1.f ), "Fiber" );
|
||||
}
|
||||
}
|
||||
ImGui::EndTable();
|
||||
ImGui::TreePop();
|
||||
}
|
||||
if( threadsChanged ) m_waitStack = 0;
|
||||
|
||||
@@ -837,9 +837,22 @@ void View::DrawFlameGraph()
|
||||
m_flameGraphInvariant.Reset();
|
||||
}
|
||||
|
||||
const auto& style = ImGui::GetStyle();
|
||||
float probe = 0;
|
||||
for( auto& t : td )
|
||||
{
|
||||
float w = ImGui::GetFrameHeight() * 2 + ImGui::CalcTextSize( m_worker.GetThreadName( t->id ) ).x + style.ItemSpacing.x * 2;
|
||||
if( t->isFiber ) w += style.ItemSpacing.x + ImGui::CalcTextSize( "Fiber" ).x;
|
||||
probe = std::max( probe, w );
|
||||
}
|
||||
const auto MinWidth = std::max( 150 * GetScale(), probe );
|
||||
const int cols = std::max( 1, int( ImGui::GetContentRegionAvail().x / MinWidth ) );
|
||||
|
||||
int idx = 0;
|
||||
ImGui::BeginTable( "##flamegraphthreadcols", cols, ImGuiTableFlags_NoSavedSettings );
|
||||
for( const auto& t : td )
|
||||
{
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::PushID( idx++ );
|
||||
const auto threadColor = GetThreadColor( t->id, 0 );
|
||||
SmallColorBox( threadColor );
|
||||
@@ -852,6 +865,7 @@ void View::DrawFlameGraph()
|
||||
TextColoredUnformatted( ImVec4( 0.2f, 0.6f, 0.2f, 1.f ), "Fiber" );
|
||||
}
|
||||
}
|
||||
ImGui::EndTable();
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
|
||||
@@ -196,10 +196,27 @@ void View::DrawMessages()
|
||||
if( expand )
|
||||
{
|
||||
auto& crash = m_worker.GetCrashEvent();
|
||||
|
||||
const auto& style = ImGui::GetStyle();
|
||||
const auto cntWidth = ImGui::CalcTextSize( "(1234)" ).x;
|
||||
float probe = 0;
|
||||
for( auto& t : m_threadOrder )
|
||||
{
|
||||
if( t->messages.empty() ) continue;
|
||||
float w = ImGui::GetFrameHeight() * 2 + ImGui::CalcTextSize( m_worker.GetThreadName( t->id ) ).x + cntWidth + style.ItemSpacing.x * 3;
|
||||
if( crash.thread == t->id ) w += style.ItemSpacing.x + ImGui::CalcTextSize( ICON_FA_SKULL " Crashed" ).x;
|
||||
if( t->isFiber ) w += style.ItemSpacing.x + ImGui::CalcTextSize( "Fiber" ).x;
|
||||
probe = std::max( probe, w );
|
||||
}
|
||||
const auto MinWidth = std::max( 150 * GetScale(), probe );
|
||||
const int cols = std::max( 1, int( ImGui::GetContentRegionAvail().x / MinWidth ) );
|
||||
|
||||
int idx = 0;
|
||||
ImGui::BeginTable( "##msgthreadcols", cols, ImGuiTableFlags_NoSavedSettings );
|
||||
for( const auto& t : m_threadOrder )
|
||||
{
|
||||
if( t->messages.empty() ) continue;
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::PushID( idx++ );
|
||||
const auto threadColor = GetThreadColor( t->id, 0 );
|
||||
SmallColorBox( threadColor );
|
||||
@@ -222,6 +239,7 @@ void View::DrawMessages()
|
||||
TextColoredUnformatted( ImVec4( 0.2f, 0.6f, 0.2f, 1.f ), "Fiber" );
|
||||
}
|
||||
}
|
||||
ImGui::EndTable();
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user