From 9f4d7fa5ad89372118715b81661fbb978e426a54 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 29 Sep 2024 00:31:01 +0200 Subject: [PATCH] Draw kernel functions red in flame graph. --- profiler/src/profiler/TracyView_FlameGraph.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/profiler/src/profiler/TracyView_FlameGraph.cpp b/profiler/src/profiler/TracyView_FlameGraph.cpp index 723f8a48..fc914138 100644 --- a/profiler/src/profiler/TracyView_FlameGraph.cpp +++ b/profiler/src/profiler/TracyView_FlameGraph.cpp @@ -272,6 +272,8 @@ void View::DrawFlameGraphItem( const FlameGraphItem& item, FlameGraphContext& ct const char* name; const char* slName; + uint32_t textColor = 0xFFFFFFFF; + if( !samples ) { srcloc = &m_worker.GetSourceLocation( item.srcloc ); @@ -280,7 +282,8 @@ void View::DrawFlameGraphItem( const FlameGraphItem& item, FlameGraphContext& ct } else { - auto sym = m_worker.GetSymbolData( (uint64_t)item.srcloc ); + const auto symAddr = (uint64_t)item.srcloc; + auto sym = m_worker.GetSymbolData( symAddr ); if( sym ) { name = m_worker.GetString( sym->name ); @@ -297,6 +300,10 @@ void View::DrawFlameGraphItem( const FlameGraphItem& item, FlameGraphContext& ct name = "???"; color = 0xFF888888; } + if( symAddr >> 63 != 0 ) + { + textColor = 0xFF8888FF; + } } const auto hiColor = HighlightColor( color ); @@ -326,12 +333,12 @@ void View::DrawFlameGraphItem( const FlameGraphItem& item, FlameGraphContext& ct if( tsz.x < zsz ) { const auto x = ( x1 + x0 - tsz.x ) * 0.5; - DrawTextContrast( ctx.draw, ImVec2( x, y0 ), 0xFFFFFFFF, name ); + DrawTextContrast( ctx.draw, ImVec2( x, y0 ), textColor, name ); } else { ImGui::PushClipRect( ImVec2( x0, y0 ), ImVec2( x1, y1 ), true ); - DrawTextContrast( ctx.draw, ImVec2( x0, y0 ), 0xFFFFFFFF, name ); + DrawTextContrast( ctx.draw, ImVec2( x0, y0 ), textColor, name ); ImGui::PopClipRect(); }