Skip to content

Commit

Permalink
Add context menu to left-click on item in symbol statistics list.
Browse files Browse the repository at this point in the history
The context menu contains two items:

1. "View symbol", which shows the symbol code / disassembly. This was
   previously available by right-clicking on the source file name.
2. "Sample entry call stacks", which brings up the list window that
   was previously available with left-click on the entry line.

This change intends to make the symbol view easier to discover.
  • Loading branch information
wolfpld committed Oct 4, 2024
1 parent 384646b commit 3e41052
Showing 1 changed file with 54 additions and 2 deletions.
56 changes: 54 additions & 2 deletions profiler/src/profiler/TracyView_Samples.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,33 @@ void View::DrawSamplesStatistics( Vector<SymList>& data, int64_t timeRange, Accu
ImGui::TextUnformatted( normalized );
TooltipNormalizedName( name, normalized );
}
if( clicked ) ShowSampleParents( v.symAddr, !m_statSeparateInlines );
if( clicked ) ImGui::OpenPopup( "menuPopup" );
if( ImGui::BeginPopup( "menuPopup" ) )
{
uint32_t len;
const bool sfv = SourceFileValid( file, m_worker.GetCaptureTime(), *this, m_worker ) || ( symlen != 0 && m_worker.GetSymbolCode( codeAddr, len ) );
if( !sfv ) ImGui::BeginDisabled();
if( ImGui::MenuItem( " " ICON_FA_FILE_LINES " View symbol" ) )
{
if( SourceFileValid( file, m_worker.GetCaptureTime(), *this, m_worker ) )
{
ViewSymbol( file, line, codeAddr, v.symAddr );
if( !m_statSeparateInlines ) m_sourceView->CalcInlineStats( false );
}
else if( symlen != 0 )
{
uint32_t len;
if( m_worker.GetSymbolCode( codeAddr, len ) )
{
ViewSymbol( nullptr, 0, codeAddr, v.symAddr );
if( !m_statSeparateInlines ) m_sourceView->CalcInlineStats( false );
}
}
}
if( !sfv ) ImGui::EndDisabled();
if( ImGui::MenuItem( ICON_FA_ARROW_DOWN_SHORT_WIDE " Sample entry call stacks" ) ) ShowSampleParents( v.symAddr, !m_statSeparateInlines );
ImGui::EndPopup();
}
ImGui::PopID();
}
if( parentName )
Expand Down Expand Up @@ -618,7 +644,33 @@ void View::DrawSamplesStatistics( Vector<SymList>& data, int64_t timeRange, Accu
ImGui::TextUnformatted( normalized );
TooltipNormalizedName( sn, normalized );
}
if( clicked ) ShowSampleParents( iv.symAddr, false );
if( clicked ) ImGui::OpenPopup( "menuPopup" );
if( ImGui::BeginPopup( "menuPopup" ) )
{
uint32_t len;
const bool sfv = SourceFileValid( file, m_worker.GetCaptureTime(), *this, m_worker ) || ( symlen != 0 && m_worker.GetSymbolCode( codeAddr, len ) );
if( !sfv ) ImGui::BeginDisabled();
if( ImGui::MenuItem( " " ICON_FA_FILE_LINES " View symbol" ) )
{
if( SourceFileValid( file, m_worker.GetCaptureTime(), *this, m_worker ) )
{
ViewSymbol( file, line, codeAddr, iv.symAddr );
if( !m_statSeparateInlines ) m_sourceView->CalcInlineStats( true );
}
else if( symlen != 0 )
{
uint32_t len;
if( m_worker.GetSymbolCode( codeAddr, len ) )
{
ViewSymbol( nullptr, 0, codeAddr, iv.symAddr );
if( !m_statSeparateInlines ) m_sourceView->CalcInlineStats( true );
}
}
}
if( !sfv ) ImGui::EndDisabled();
if( ImGui::MenuItem( ICON_FA_ARROW_DOWN_SHORT_WIDE " Sample entry call stacks" ) ) ShowSampleParents( iv.symAddr, false );
ImGui::EndPopup();
}
ImGui::PopID();
}
if( sn == parentName )
Expand Down

0 comments on commit 3e41052

Please sign in to comment.