Open find zone from flame graph.

This commit is contained in:
Bartosz Taudul 2024-09-08 13:48:22 +02:00
parent 6080b8742a
commit 959f0de7e5
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 8 additions and 2 deletions

View File

@ -1108,6 +1108,7 @@ bool View::DrawImpl()
if( m_showOptions ) DrawOptions(); if( m_showOptions ) DrawOptions();
if( m_showMessages ) DrawMessages(); if( m_showMessages ) DrawMessages();
if( m_showFlameGraph ) DrawFlameGraph();
if( m_findZone.show ) DrawFindZone(); if( m_findZone.show ) DrawFindZone();
if( m_showStatistics ) DrawStatistics(); if( m_showStatistics ) DrawStatistics();
if( m_memInfo.show ) DrawMemory(); if( m_memInfo.show ) DrawMemory();
@ -1125,7 +1126,6 @@ bool View::DrawImpl()
if( m_sampleParents.symAddr != 0 ) DrawSampleParents(); if( m_sampleParents.symAddr != 0 ) DrawSampleParents();
if( m_showRanges ) DrawRanges(); if( m_showRanges ) DrawRanges();
if( m_showWaitStacks ) DrawWaitStacks(); if( m_showWaitStacks ) DrawWaitStacks();
if( m_showFlameGraph ) DrawFlameGraph();
if( m_setRangePopup.active ) if( m_setRangePopup.active )
{ {

View File

@ -123,7 +123,8 @@ void View::DrawFlameGraphItem( const FlameGraphItem& item, FlameGraphContext& ct
const auto darkColor = DarkenColor( color ); const auto darkColor = DarkenColor( color );
const auto zsz = x1 - x0; const auto zsz = x1 - x0;
const char* name = m_worker.GetString( srcloc.name.active ? srcloc.name : srcloc.function ); const char* slName = m_worker.GetString( srcloc.name.active ? srcloc.name : srcloc.function );
const char* name = slName;
auto tsz = ImGui::CalcTextSize( name ); auto tsz = ImGui::CalcTextSize( name );
if( m_vd.shortenName == ShortenName::Always || ( ( m_vd.shortenName == ShortenName::NoSpace || m_vd.shortenName == ShortenName::NoSpaceAndNormalize ) && tsz.x > zsz ) ) if( m_vd.shortenName == ShortenName::Always || ( ( m_vd.shortenName == ShortenName::NoSpace || m_vd.shortenName == ShortenName::NoSpaceAndNormalize ) && tsz.x > zsz ) )
@ -166,6 +167,11 @@ void View::DrawFlameGraphItem( const FlameGraphItem& item, FlameGraphContext& ct
TextFocused( "Time:", TimeToString( item.time ) ); TextFocused( "Time:", TimeToString( item.time ) );
if( !item.children.empty() ) TextFocused( "Self time:", TimeToString( self ) ); if( !item.children.empty() ) TextFocused( "Self time:", TimeToString( self ) );
ImGui::EndTooltip(); ImGui::EndTooltip();
if( ImGui::IsMouseClicked( 0 ) )
{
m_findZone.ShowZone( item.srcloc, slName );
}
} }
uint64_t cts = ts; uint64_t cts = ts;