Draw kernel functions red in flame graph.

This commit is contained in:
Bartosz Taudul 2024-09-29 00:31:01 +02:00
parent 346d8a45c6
commit 9f4d7fa5ad
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -272,6 +272,8 @@ void View::DrawFlameGraphItem( const FlameGraphItem& item, FlameGraphContext& ct
const char* name; const char* name;
const char* slName; const char* slName;
uint32_t textColor = 0xFFFFFFFF;
if( !samples ) if( !samples )
{ {
srcloc = &m_worker.GetSourceLocation( item.srcloc ); srcloc = &m_worker.GetSourceLocation( item.srcloc );
@ -280,7 +282,8 @@ void View::DrawFlameGraphItem( const FlameGraphItem& item, FlameGraphContext& ct
} }
else 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 ) if( sym )
{ {
name = m_worker.GetString( sym->name ); name = m_worker.GetString( sym->name );
@ -297,6 +300,10 @@ void View::DrawFlameGraphItem( const FlameGraphItem& item, FlameGraphContext& ct
name = "???"; name = "???";
color = 0xFF888888; color = 0xFF888888;
} }
if( symAddr >> 63 != 0 )
{
textColor = 0xFF8888FF;
}
} }
const auto hiColor = HighlightColor( color ); const auto hiColor = HighlightColor( color );
@ -326,12 +333,12 @@ void View::DrawFlameGraphItem( const FlameGraphItem& item, FlameGraphContext& ct
if( tsz.x < zsz ) if( tsz.x < zsz )
{ {
const auto x = ( x1 + x0 - tsz.x ) * 0.5; 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 else
{ {
ImGui::PushClipRect( ImVec2( x0, y0 ), ImVec2( x1, y1 ), true ); 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(); ImGui::PopClipRect();
} }