mirror of
https://github.com/wolfpld/tracy.git
synced 2026-09-22 10:14:24 +00:00
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:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user