htop icon indicating copy to clipboard operation
htop copied to clipboard

Fix CPU meters

Open kremlin- opened this issue 7 years ago • 3 comments

Introduction of CP_SPIN sched state broke hard-coded state indexes resulting in the meters incorrectly reporting bogus intr data instead of CPU usage. Change hardcoded values to sched.h macros.

kremlin- avatar Jul 17 '18 13:07 kremlin-

Also fix a zero index bug

kremlin- avatar Jul 17 '18 14:07 kremlin-

Thank you for looking into this — help with ports is definitely appreciated! I was reviewing that code of Platform_setCPUValues and ended up wondering: are the color bars returning values with their correct meanings on OpenBSD? When trying to follow the code, it seems it gets the vector of CPU states straight from the sysctl and that then goes into the this->values vector of the Meter object, which for a CPUMeter, has this sequence (clearly based on Linux).

So this left me wondering if the numbers match the names: on OpenBSD is the first (blue) part of the bar really showing the numbers for NICE, the second (green) bar the number for NORMAL, the third (red) the number for KERNEL, etc? (In other words, what are the names/values for those CP_* enum values on OpenBSD?) If they're not in the right order, then that v vector might need to be reordered for calculation/display...

hishamhm avatar Jul 28 '18 02:07 hishamhm

Merged here: htop-dev/htop@5a17cee

natoscott avatar Aug 19 '20 08:08 natoscott