From 88b2b04b0d6d289c22e0e81f6b5b20553c7996d7 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 3 May 2020 14:34:22 +0200 Subject: [PATCH] Display running threads in CPU usage tooltip. --- server/TracyView.cpp | 48 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index c4e1f2d1..834d3d19 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -5235,6 +5235,54 @@ int View::DrawCpuData( int offset, double pxns, const ImVec2& wpos, bool hover, PrintStringPercent( buf, usageOther * cpuCntRev * 100 ); TextDisabledUnformatted( buf ); TextFocused( "Number of cores:", RealToString( cpuCnt ) ); + if( usageOwn + usageOther != 0 ) + { + ImGui::Separator(); + for( int i=0; iStart() <= mt && it->End() >= mt ) + { + auto tt = m_worker.GetThreadTopology( i ); + if( tt ) + { + ImGui::TextDisabled( "[%i:%i] CPU %i:", tt->package, tt->core, i ); + } + else + { + ImGui::TextDisabled( "CPU %i:", i ); + } + ImGui::SameLine(); + const auto thread = m_worker.DecompressThreadExternal( it->Thread() ); + bool local, untracked; + const char* txt; + auto label = GetThreadContextData( thread, local, untracked, txt ); + if( local || untracked ) + { + uint32_t color; + if( m_vd.dynamicColors != 0 ) + { + color = local ? GetThreadColor( thread, 0 ) : ( untracked ? 0xFF663333 : 0xFF444444 ); + } + else + { + color = local ? 0xFF334488 : ( untracked ? 0xFF663333 : 0xFF444444 ); + } + TextColoredUnformatted( HighlightColor<75>( color ), label ); + ImGui::SameLine(); + ImGui::TextDisabled( "(%s)", RealToString( thread ) ); + } + else + { + TextDisabledUnformatted( label ); + } + } + } + } + } ImGui::EndTooltip(); } }