Add "smart" symbol location to sampled statistics.

This commit is contained in:
Bartosz Taudul 2020-03-30 23:58:42 +02:00
parent eb48d24182
commit b957087456
2 changed files with 31 additions and 14 deletions

View File

@ -11035,7 +11035,7 @@ void View::DrawCompare()
void View::DrawStatistics() void View::DrawStatistics()
{ {
ImGui::SetNextWindowSize( ImVec2( 1350, 600 ), ImGuiCond_FirstUseEver ); ImGui::SetNextWindowSize( ImVec2( 1400, 600 ), ImGuiCond_FirstUseEver );
ImGui::Begin( "Statistics", &m_showStatistics, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse ); ImGui::Begin( "Statistics", &m_showStatistics, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse );
#ifdef TRACY_NO_STATISTICS #ifdef TRACY_NO_STATISTICS
ImGui::TextWrapped( "Collection of statistical data is disabled in this build." ); ImGui::TextWrapped( "Collection of statistical data is disabled in this build." );
@ -11166,11 +11166,11 @@ void View::DrawStatistics()
if( !widthSet ) if( !widthSet )
{ {
widthSet = true; widthSet = true;
ImGui::SetColumnWidth( 0, w * 0.3f ); ImGui::SetColumnWidth( 0, w * 0.325f );
ImGui::SetColumnWidth( 1, w * 0.4f ); ImGui::SetColumnWidth( 1, w * 0.425f );
ImGui::SetColumnWidth( 2, w * 0.1f ); ImGui::SetColumnWidth( 2, w * 0.1f );
ImGui::SetColumnWidth( 3, w * 0.1f ); ImGui::SetColumnWidth( 3, w * 0.075f );
ImGui::SetColumnWidth( 4, w * 0.1f ); ImGui::SetColumnWidth( 4, w * 0.075f );
} }
ImGui::TextUnformatted( "Name" ); ImGui::TextUnformatted( "Name" );
ImGui::NextColumn(); ImGui::NextColumn();
@ -11271,6 +11271,8 @@ void View::DrawStatistics()
ImGui::SameLine(); ImGui::SameLine();
ImGui::TextUnformatted( "Location:" ); ImGui::TextUnformatted( "Location:" );
ImGui::SameLine(); ImGui::SameLine();
ImGui::RadioButton( "Smart", &m_statSampleLocation, 2 );
ImGui::SameLine();
ImGui::RadioButton( "Entry point", &m_statSampleLocation, 0 ); ImGui::RadioButton( "Entry point", &m_statSampleLocation, 0 );
ImGui::SameLine(); ImGui::SameLine();
ImGui::RadioButton( "Sample", &m_statSampleLocation, 1 ); ImGui::RadioButton( "Sample", &m_statSampleLocation, 1 );
@ -11373,10 +11375,10 @@ void View::DrawStatistics()
if( !widthSet ) if( !widthSet )
{ {
widthSet = true; widthSet = true;
ImGui::SetColumnWidth( 0, w * 0.3f ); ImGui::SetColumnWidth( 0, w * 0.31f );
ImGui::SetColumnWidth( 1, w * 0.375f ); ImGui::SetColumnWidth( 1, w * 0.4f );
ImGui::SetColumnWidth( 2, w * 0.125f ); ImGui::SetColumnWidth( 2, w * 0.115f );
ImGui::SetColumnWidth( 3, w * 0.125f ); ImGui::SetColumnWidth( 3, w * 0.1f );
ImGui::SetColumnWidth( 4, w * 0.075f ); ImGui::SetColumnWidth( 4, w * 0.075f );
} }
ImGui::TextUnformatted( "Name" ); ImGui::TextUnformatted( "Name" );
@ -11413,15 +11415,30 @@ void View::DrawStatistics()
name = m_worker.GetString( sit->second.name ); name = m_worker.GetString( sit->second.name );
imageName = m_worker.GetString( sit->second.imageName ); imageName = m_worker.GetString( sit->second.imageName );
isInline = sit->second.isInline; isInline = sit->second.isInline;
if( m_statSampleLocation == 0 ) switch( m_statSampleLocation )
{ {
case 0:
file = m_worker.GetString( sit->second.file ); file = m_worker.GetString( sit->second.file );
line = sit->second.line; line = sit->second.line;
} break;
else case 1:
{
file = m_worker.GetString( sit->second.callFile ); file = m_worker.GetString( sit->second.callFile );
line = sit->second.callLine; line = sit->second.callLine;
break;
case 2:
if( sit->second.isInline )
{
file = m_worker.GetString( sit->second.callFile );
line = sit->second.callLine;
}
else
{
file = m_worker.GetString( sit->second.file );
line = sit->second.line;
}
default:
assert( false );
break;
} }
if( m_statHideUnknown && file[0] == '[' ) continue; if( m_statHideUnknown && file[0] == '[' ) continue;
symlen = sit->second.size.Val(); symlen = sit->second.size.Val();

View File

@ -355,7 +355,7 @@ private:
bool m_statSelf = true; bool m_statSelf = true;
bool m_statSampleTime = true; bool m_statSampleTime = true;
int m_statMode = 0; int m_statMode = 0;
int m_statSampleLocation = 0; int m_statSampleLocation = 2;
bool m_statHideUnknown = true; bool m_statHideUnknown = true;
bool m_showAllSymbols = false; bool m_showAllSymbols = false;
int m_showCallstackFrameAddress = 0; int m_showCallstackFrameAddress = 0;