summaryrefslogtreecommitdiffstats
path: root/CPUMeter.c
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2010-06-30 18:29:54 +0000
committerHisham Muhammad <hisham@gobolinux.org>2010-06-30 18:29:54 +0000
commit655c29bce5593ed7d4a06b37fbd970097040684c (patch)
treecca23a6d5234b56319030519bd87262fbd8469e2 /CPUMeter.c
parent65bc58ed50d15382d21476b8b25e0145879a8d75 (diff)
Fix display of nan% in CPU meters
(Fix by Steven Hampson)
Diffstat (limited to 'CPUMeter.c')
-rw-r--r--CPUMeter.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/CPUMeter.c b/CPUMeter.c
index 567cfae2..43d2cfad 100644
--- a/CPUMeter.c
+++ b/CPUMeter.c
@@ -47,7 +47,7 @@ static void CPUMeter_setValues(Meter* this, char* buffer, int size) {
snprintf(buffer, size, "absent");
return;
}
- double total = (double) pl->totalPeriod[processor];
+ double total = (double) (pl->totalPeriod[processor] == 0 ? 1 : pl->totalPeriod[processor]);
double cpu;
this->values[0] = pl->nicePeriod[processor] / total * 100.0;
this->values[1] = pl->userPeriod[processor] / total * 100.0;

© 2014-2024 Faster IT GmbH | imprint | privacy policy