Pulling implementation in to a separate function.

This commit is contained in:
David McCloskey
2026-07-10 12:00:48 -05:00
parent 655b8295cf
commit 7d1a37de2d
3 changed files with 13 additions and 12 deletions

View File

@@ -31,6 +31,7 @@
#include "../server/TracyWorker.hpp"
#include "../server/tracy_robin_hood.h"
#include "../server/TracyVector.hpp"
#include "../server/tracy_pdqsort.h"
#ifndef __EMSCRIPTEN__
# include "TracyLlm.hpp"
@@ -517,6 +518,16 @@ private:
return it->second;
}
tracy_force_inline void SortThreads()
{
pdqsort_branchless( m_threadOrder.begin(), m_threadOrder.end(), [this] ( const auto& lhs, const auto& rhs ) {
if( lhs->groupHint != rhs->groupHint ) return lhs->groupHint < rhs->groupHint;
const auto cmp = strcmp( m_worker.GetThreadName( lhs->id ), m_worker.GetThreadName( rhs->id ) );
if( cmp != 0 ) return cmp < 0;
return lhs->id < rhs->id;
} );
}
static int64_t AdjustGpuTime( int64_t time, int64_t begin, int drift );
static const char* DecodeContextSwitchState( uint8_t state );

View File

@@ -1072,12 +1072,7 @@ void View::DrawFlameGraph()
ImGui::SameLine();
if( ImGui::SmallButton( "Sort" ) )
{
pdqsort_branchless( m_threadOrder.begin(), m_threadOrder.end(), [this] ( const auto& lhs, const auto& rhs ) {
if( lhs->groupHint != rhs->groupHint ) return lhs->groupHint < rhs->groupHint;
const auto cmp = strcmp( m_worker.GetThreadName( lhs->id ), m_worker.GetThreadName( rhs->id ) );
if( cmp != 0 ) return cmp < 0;
return lhs->id < rhs->id;
} );
SortThreads();
}
const auto& style = ImGui::GetStyle();

View File

@@ -698,12 +698,7 @@ void View::DrawOptions()
ImGui::SameLine();
if( ImGui::SmallButton( "Sort" ) )
{
pdqsort_branchless( m_threadOrder.begin(), m_threadOrder.end(), [this] ( const auto& lhs, const auto& rhs ) {
if( lhs->groupHint != rhs->groupHint ) return lhs->groupHint < rhs->groupHint;
const auto cmp = strcmp( m_worker.GetThreadName( lhs->id ), m_worker.GetThreadName( rhs->id ) );
if( cmp != 0 ) return cmp < 0;
return lhs->id < rhs->id;
} );
SortThreads();
}
const auto wposx = ImGui::GetCursorScreenPos().x;