summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CPUMeter.c2
-rw-r--r--ChangeLog2
2 files changed, 3 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;
diff --git a/ChangeLog b/ChangeLog
index 29ab22cb..c7707bc3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,8 @@ What's new in version 0.8.4
(thanks to Tom Callaway)
* getopt-based long options and --no-color
(thanks to Vincent Launchbury)
+* BUGFIX: Fix display of nan% in CPU meters
+ (thanks to Steven Hampson)
* BUGFIX: Fix memory leak
(thanks to Pavol Rusnak)
* Add Bash/emacs style navigation keys