From dd8eff0de6ce7aaf2081fcbcf0b6cf4bd7ee351b Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 25 Jul 2026 21:39:43 +0200 Subject: [PATCH] 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. --- profiler/src/profiler/TracyView_Samples.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/profiler/src/profiler/TracyView_Samples.cpp b/profiler/src/profiler/TracyView_Samples.cpp index 1b2c9899..00f2e57d 100644 --- a/profiler/src/profiler/TracyView_Samples.cpp +++ b/profiler/src/profiler/TracyView_Samples.cpp @@ -627,7 +627,7 @@ void View::DrawSamplesStatistics( Vector& 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& 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 {