diff --git a/server/TracyView.cpp b/server/TracyView.cpp index b8a655df..22a773d7 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -5504,44 +5504,6 @@ int View::DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos, return cnt; } -const char* View::GetThreadContextData( uint64_t thread, bool& _local, bool& _untracked, const char*& program ) -{ - static char buf[256]; - const auto local = m_worker.IsThreadLocal( thread ); - auto txt = local ? m_worker.GetThreadName( thread ) : m_worker.GetExternalName( thread ).first; - auto label = txt; - bool untracked = false; - if( !local ) - { - if( m_worker.GetPid() == 0 ) - { - untracked = strcmp( txt, m_worker.GetCaptureProgram().c_str() ) == 0; - } - else - { - const auto pid = m_worker.GetPidFromTid( thread ); - untracked = pid == m_worker.GetPid(); - if( untracked ) - { - label = txt = m_worker.GetExternalName( thread ).second; - } - else - { - const auto ttxt = m_worker.GetExternalName( thread ).second; - if( strcmp( ttxt, "???" ) != 0 && strcmp( ttxt, txt ) != 0 ) - { - snprintf( buf, 256, "%s (%s)", txt, ttxt ); - label = buf; - } - } - } - } - _local = local; - _untracked = untracked; - program = txt; - return label; -} - int View::DrawCpuData( int offset, double pxns, const ImVec2& wpos, bool hover, float yMin, float yMax ) { auto cpuData = m_worker.GetCpuData(); diff --git a/server/TracyView_Utility.cpp b/server/TracyView_Utility.cpp index 32c5727b..d30e55e8 100644 --- a/server/TracyView_Utility.cpp +++ b/server/TracyView_Utility.cpp @@ -805,4 +805,42 @@ const char* View::ShortenNamespace( const char* name ) const } } +const char* View::GetThreadContextData( uint64_t thread, bool& _local, bool& _untracked, const char*& program ) +{ + static char buf[256]; + const auto local = m_worker.IsThreadLocal( thread ); + auto txt = local ? m_worker.GetThreadName( thread ) : m_worker.GetExternalName( thread ).first; + auto label = txt; + bool untracked = false; + if( !local ) + { + if( m_worker.GetPid() == 0 ) + { + untracked = strcmp( txt, m_worker.GetCaptureProgram().c_str() ) == 0; + } + else + { + const auto pid = m_worker.GetPidFromTid( thread ); + untracked = pid == m_worker.GetPid(); + if( untracked ) + { + label = txt = m_worker.GetExternalName( thread ).second; + } + else + { + const auto ttxt = m_worker.GetExternalName( thread ).second; + if( strcmp( ttxt, "???" ) != 0 && strcmp( ttxt, txt ) != 0 ) + { + snprintf( buf, 256, "%s (%s)", txt, ttxt ); + label = buf; + } + } + } + } + _local = local; + _untracked = untracked; + program = txt; + return label; +} + }