diff options
author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2023-03-03 23:47:43 +0100 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2023-03-04 12:41:16 +0100 |
commit | c803ec6dae5556fa35d6bd8124aa536633887f77 (patch) | |
tree | 8196fb34f6f1d2398b30989d8bab2024334a5024 /linux/Platform.c | |
parent | 11318b5ef6de6b2f80186a888cd5477e0ff167bb (diff) |
Improve code readability by using enum values instead of raw numbers
Diffstat (limited to 'linux/Platform.c')
-rw-r--r-- | linux/Platform.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/linux/Platform.c b/linux/Platform.c index 005d8316..93be689d 100644 --- a/linux/Platform.c +++ b/linux/Platform.c @@ -325,15 +325,15 @@ double Platform_setCPUValues(Meter* this, unsigned int cpu) { v[CPU_METER_IOWAIT] = cpuData->ioWaitPeriod / total * 100.0; this->curItems = 8; if (this->pl->settings->accountGuestInCPUMeter) { - percent = v[0] + v[1] + v[2] + v[3] + v[4] + v[5] + v[6]; + percent = v[CPU_METER_NICE] + v[CPU_METER_NORMAL] + v[CPU_METER_KERNEL] + v[CPU_METER_IRQ] + v[CPU_METER_SOFTIRQ] + v[CPU_METER_STEAL] + v[CPU_METER_GUEST]; } else { - percent = v[0] + v[1] + v[2] + v[3] + v[4]; + percent = v[CPU_METER_NICE] + v[CPU_METER_NORMAL] + v[CPU_METER_KERNEL] + v[CPU_METER_IRQ] + v[CPU_METER_SOFTIRQ]; } } else { - v[2] = cpuData->systemAllPeriod / total * 100.0; - v[3] = (cpuData->stealPeriod + cpuData->guestPeriod) / total * 100.0; + v[CPU_METER_KERNEL] = cpuData->systemAllPeriod / total * 100.0; + v[CPU_METER_IRQ] = (cpuData->stealPeriod + cpuData->guestPeriod) / total * 100.0; this->curItems = 4; - percent = v[0] + v[1] + v[2] + v[3]; + percent = v[CPU_METER_NICE] + v[CPU_METER_NORMAL] + v[CPU_METER_KERNEL] + v[CPU_METER_IRQ]; } percent = CLAMP(percent, 0.0, 100.0); if (isnan(percent)) { |