Fix display of nan% in CPU meters

(Fix by Steven Hampson)
This commit is contained in:
Hisham Muhammad
2010-06-30 18:29:54 +00:00
parent 65bc58ed50
commit 655c29bce5
2 changed files with 3 additions and 1 deletions

View File

@ -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;