mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
CPUUsage: don't count NaN values
This commit is contained in:
@@ -22,7 +22,7 @@ void ffPrintCPUUsage(FFCPUUsageOptions* options)
|
||||
double maxValue = -999, minValue = 999, sumValue = 0;
|
||||
uint32_t maxIndex = 999, minIndex = 999;
|
||||
|
||||
uint32_t index = 0;
|
||||
uint32_t index = 0, valueCount = 0;
|
||||
FF_LIST_FOR_EACH(double, percent, percentages)
|
||||
{
|
||||
if (*percent == *percent)
|
||||
@@ -38,10 +38,11 @@ void ffPrintCPUUsage(FFCPUUsageOptions* options)
|
||||
minValue = *percent;
|
||||
minIndex = index;
|
||||
}
|
||||
++valueCount;
|
||||
}
|
||||
++index;
|
||||
}
|
||||
double avgValue = sumValue / (double) percentages.length;
|
||||
double avgValue = sumValue / (double) valueCount;
|
||||
|
||||
if(options->moduleArgs.outputFormat.length == 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user