prevent negative cpu percentage

This commit is contained in:
Doug MacEachern 2004-12-17 07:04:50 +00:00
parent 55e669634c
commit a168c9c0f6
1 changed files with 4 additions and 0 deletions

View File

@ -57,6 +57,10 @@ public class MultiProcCpu extends ProcCpu {
}
cpu.percent = ((cpu.total - otime) / diff);
if (cpu.percent < 0.0) {
//counter wrapped
cpu.percent = (0.0 - cpu.percent);
}
if (cpu.percent >= 1.0) {
cpu.percent = 0.99;
}