From 4394d79c39edc6222a54fdc8e353b22b88b4de28 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 1 May 2026 21:20:27 +0200 Subject: [PATCH] Limit "visible threads" rows displayed at once. --- profiler/src/profiler/TracyView_ContextSwitch.cpp | 6 ++++++ profiler/src/profiler/TracyView_FlameGraph.cpp | 6 ++++++ profiler/src/profiler/TracyView_Messages.cpp | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/profiler/src/profiler/TracyView_ContextSwitch.cpp b/profiler/src/profiler/TracyView_ContextSwitch.cpp index 5b98092d..81e56c7f 100644 --- a/profiler/src/profiler/TracyView_ContextSwitch.cpp +++ b/profiler/src/profiler/TracyView_ContextSwitch.cpp @@ -523,6 +523,11 @@ void View::DrawWaitStacks() const auto MinWidth = std::max( 150 * GetScale(), probe ); const int cols = std::max( 1, int( ImGui::GetContentRegionAvail().x / MinWidth ) ); + const auto rows = ( m_threadOrder.size() + cols - 1 ) / cols; + const auto rowsVisible = std::min( rows, 8 ); + const auto rowsHeight = ImGui::GetTextLineHeightWithSpacing() * rowsVisible; + ImGui::BeginChild( "###waitstackthreadrows", ImVec2( -1, rowsHeight ) ); + int idx = 0; ImGui::BeginTable( "##waitstackthreadcols", cols, ImGuiTableFlags_NoSavedSettings ); for( const auto& t : m_threadOrder ) @@ -552,6 +557,7 @@ void View::DrawWaitStacks() } } ImGui::EndTable(); + ImGui::EndChild(); ImGui::TreePop(); } if( threadsChanged ) m_waitStack = 0; diff --git a/profiler/src/profiler/TracyView_FlameGraph.cpp b/profiler/src/profiler/TracyView_FlameGraph.cpp index c6fb99da..a4fd96d1 100644 --- a/profiler/src/profiler/TracyView_FlameGraph.cpp +++ b/profiler/src/profiler/TracyView_FlameGraph.cpp @@ -848,6 +848,11 @@ void View::DrawFlameGraph() const auto MinWidth = std::max( 150 * GetScale(), probe ); const int cols = std::max( 1, int( ImGui::GetContentRegionAvail().x / MinWidth ) ); + const auto rows = ( tsz + cols - 1 ) / cols; + const auto rowsVisible = std::min( rows, 8 ); + const auto rowsHeight = ImGui::GetTextLineHeightWithSpacing() * rowsVisible; + ImGui::BeginChild( "###flamegraphthreadrows", ImVec2( -1, rowsHeight ) ); + int idx = 0; ImGui::BeginTable( "##flamegraphthreadcols", cols, ImGuiTableFlags_NoSavedSettings ); for( const auto& t : td ) @@ -866,6 +871,7 @@ void View::DrawFlameGraph() } } ImGui::EndTable(); + ImGui::EndChild(); ImGui::TreePop(); } diff --git a/profiler/src/profiler/TracyView_Messages.cpp b/profiler/src/profiler/TracyView_Messages.cpp index 8e10f3a0..43fc70c8 100644 --- a/profiler/src/profiler/TracyView_Messages.cpp +++ b/profiler/src/profiler/TracyView_Messages.cpp @@ -211,6 +211,11 @@ void View::DrawMessages() const auto MinWidth = std::max( 150 * GetScale(), probe ); const int cols = std::max( 1, int( ImGui::GetContentRegionAvail().x / MinWidth ) ); + const auto rows = ( tsz + cols - 1 ) / cols; + const auto rowsVisible = std::min( rows, 8 ); + const auto rowsHeight = ImGui::GetTextLineHeightWithSpacing() * rowsVisible; + ImGui::BeginChild( "###msgthreadrows", ImVec2( -1, rowsHeight ) ); + int idx = 0; ImGui::BeginTable( "##msgthreadcols", cols, ImGuiTableFlags_NoSavedSettings ); for( const auto& t : m_threadOrder ) @@ -240,6 +245,7 @@ void View::DrawMessages() } } ImGui::EndTable(); + ImGui::EndChild(); ImGui::TreePop(); }