From 1390c8c9e3d7caad932bb725e599d5afb269b592 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 3 Aug 2024 20:11:55 +0200 Subject: [PATCH] Take group hint into account when sorting threads. --- profiler/src/profiler/TracyView_Options.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/profiler/src/profiler/TracyView_Options.cpp b/profiler/src/profiler/TracyView_Options.cpp index 1954b48e..813ddcb7 100644 --- a/profiler/src/profiler/TracyView_Options.cpp +++ b/profiler/src/profiler/TracyView_Options.cpp @@ -608,7 +608,10 @@ void View::DrawOptions() ImGui::SameLine(); if( ImGui::SmallButton( "Sort" ) ) { - std::sort( m_threadOrder.begin(), m_threadOrder.end(), [this] ( const auto& lhs, const auto& rhs ) { return strcmp( m_worker.GetThreadName( lhs->id ), m_worker.GetThreadName( rhs->id ) ) < 0; } ); + std::sort( m_threadOrder.begin(), m_threadOrder.end(), [this] ( const auto& lhs, const auto& rhs ) { + if( lhs->groupHint != rhs->groupHint ) return lhs->groupHint < rhs->groupHint; + return strcmp( m_worker.GetThreadName( lhs->id ), m_worker.GetThreadName( rhs->id ) ) < 0; + } ); } const auto wposx = ImGui::GetCursorScreenPos().x;