Skip to content

Commit 256c9be

Browse files
committed
CPUUsage: skip NaN when summarizing values
1 parent 1b3d713 commit 256c9be

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/modules/cpuusage/cpuusage.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,19 @@ void ffPrintCPUUsage(FFCPUUsageOptions* options)
2525
uint32_t index = 0;
2626
FF_LIST_FOR_EACH(double, percent, percentages)
2727
{
28-
sumValue += *percent;
29-
if (*percent > maxValue)
28+
if (*percent == *percent)
3029
{
31-
maxValue = *percent;
32-
maxIndex = index;
33-
}
34-
if (*percent < minValue)
35-
{
36-
minValue = *percent;
37-
minIndex = index;
30+
sumValue += *percent;
31+
if (*percent > maxValue)
32+
{
33+
maxValue = *percent;
34+
maxIndex = index;
35+
}
36+
if (*percent < minValue)
37+
{
38+
minValue = *percent;
39+
minIndex = index;
40+
}
3841
}
3942
++index;
4043
}

0 commit comments

Comments
 (0)