diff options
author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2023-03-04 12:09:24 +0100 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2023-03-04 12:41:16 +0100 |
commit | e207c8aebdcdb88bc8ab838e2ac3dd1774d6a618 (patch) | |
tree | 4bd6629235c9e849385736d750383b117fc4ebcf /openbsd | |
parent | c803ec6dae5556fa35d6bd8124aa536633887f77 (diff) |
Improve CPU computation code
Diffstat (limited to 'openbsd')
-rw-r--r-- | openbsd/Platform.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/openbsd/Platform.c b/openbsd/Platform.c index 615397e2..e49a0f81 100644 --- a/openbsd/Platform.c +++ b/openbsd/Platform.c @@ -205,13 +205,12 @@ double Platform_setCPUValues(Meter* this, unsigned int cpu) { v[CPU_METER_IOWAIT] = 0.0; v[CPU_METER_FREQUENCY] = NAN; this->curItems = 8; - totalPercent = v[CPU_METER_NICE] + v[CPU_METER_NORMAL] + v[CPU_METER_KERNEL] + v[CPU_METER_IRQ]; } else { v[CPU_METER_KERNEL] = cpuData->sysAllPeriod / total * 100.0; v[CPU_METER_IRQ] = 0.0; // No steal nor guest on OpenBSD - totalPercent = v[CPU_METER_NICE] + v[CPU_METER_NORMAL] + v[CPU_METER_KERNEL]; this->curItems = 4; } + totalPercent = v[CPU_METER_NICE] + v[CPU_METER_NORMAL] + v[CPU_METER_KERNEL] + v[CPU_METER_IRQ]; totalPercent = CLAMP(totalPercent, 0.0, 100.0); |