Ability to display inline function cost percentages relative to base symbol.

This commit is contained in:
Bartosz Taudul 2024-03-13 19:50:21 +01:00
parent 6235343286
commit 6c34e02dc2
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
3 changed files with 24 additions and 2 deletions

View File

@ -495,6 +495,7 @@ private:
bool m_showUnknownFrames = true;
bool m_statSeparateInlines = false;
bool m_mergeInlines = false;
bool m_relativeInlines = false;
bool m_statShowAddress = false;
bool m_statShowKernel = true;
bool m_groupChildrenLocations = false;

View File

@ -383,6 +383,7 @@ void View::DrawSamplesStatistics( Vector<SymList>& data, int64_t timeRange, Accu
ImGui::TableNextColumn();
TextDisabledUnformatted( imageName );
ImGui::TableNextColumn();
const auto baseCnt = cnt;
if( cnt > 0 )
{
char buf[64];
@ -420,6 +421,7 @@ void View::DrawSamplesStatistics( Vector<SymList>& data, int64_t timeRange, Accu
{
assert( v.count > 0 );
assert( symlen != 0 );
const auto revBaseCnt = 100.0 / baseCnt;
auto inSym = m_worker.GetInlineSymbolList( v.symAddr, symlen );
assert( inSym != nullptr );
const auto symEnd = v.symAddr + symlen;
@ -642,12 +644,27 @@ void View::DrawSamplesStatistics( Vector<SymList>& data, int64_t timeRange, Accu
{
const auto t = cnt * period;
ImGui::TextUnformatted( TimeToString( t ) );
PrintStringPercent( buf, 100. * t / timeRange );
if( m_relativeInlines )
{
const auto tBase = baseCnt * period;
PrintStringPercent( buf, 100. * t / tBase );
}
else
{
PrintStringPercent( buf, 100. * t / timeRange );
}
}
else
{
ImGui::TextUnformatted( RealToString( cnt ) );
PrintStringPercent( buf, cnt * revSampleCount100 );
if( m_relativeInlines )
{
PrintStringPercent( buf, cnt * revBaseCnt );
}
else
{
PrintStringPercent( buf, cnt * revSampleCount100 );
}
}
ImGui::SameLine();
TextDisabledUnformatted( buf );

View File

@ -304,6 +304,10 @@ void View::DrawStatistics()
ImGui::SameLine();
ImGui::Spacing();
ImGui::SameLine();
ImGui::Checkbox( "Relative", &m_relativeInlines );
ImGui::SameLine();
ImGui::Spacing();
ImGui::SameLine();
ImGui::Checkbox( ICON_FA_AT " Address", &m_statShowAddress );
ImGui::SameLine();
ImGui::Spacing();