Guard relative inline percentages against an empty base count.

Since the inclusive count of an aggregated symbol entry is taken from
the base symbol's own statistics, a row whose base symbol could not be
resolved can display an inclusive count of zero while its inline
functions have nonzero counts. With the relative inline display active,
the per-inline percentages divided by the base count, printing infinity
in such cases. The time percentage variant divided by the same count
scaled by the sampling period, which cancels out, so both variants can
share the guarded reciprocal.
This commit is contained in:
Bartosz Taudul
2026-07-25 21:39:43 +02:00
parent 46c70fcbb8
commit dd8eff0de6

View File

@@ -627,7 +627,7 @@ void View::DrawSamplesStatistics( Vector<SymList>& data, int64_t timeRange, Accu
if( !m_statSeparateInlines && expand )
{
const auto revBaseCnt = 100.0 / baseCnt;
const auto revBaseCnt = baseCnt == 0 ? 0 : 100.0 / baseCnt;
ImGui::Indent();
for( auto& iv : inSymList )
{
@@ -828,8 +828,7 @@ void View::DrawSamplesStatistics( Vector<SymList>& data, int64_t timeRange, Accu
ImGui::TextUnformatted( TimeToString( t ) );
if( m_relativeInlines )
{
const auto tBase = baseCnt * period;
PrintStringPercent( buf, 100. * t / tBase );
PrintStringPercent( buf, cnt * revBaseCnt );
}
else
{