htop icon indicating copy to clipboard operation
htop copied to clipboard

Fix CPU usage on OpenBSD

Open motet-a opened this issue 5 years ago • 1 comments

The current OpenBSD-specific CPU usage code is broken. The cpu parameter of Platform_setCPUValues is an integer in the interval [0, cpuCount], not [0, cpuCount-1]: Actual CPUs are numbered from 1, the “zero” CPU is a “virtual” one which represents the average of actual CPUs (I guess it’s inherited from Linux’s /proc/stats). This off-by-one error leads to random crashes.

Moreover, the displayed CPU usage is more detailed with system, user and nice times.

I made the OpenBSD CPU code more similar to the Linux CPU code, removing a few old bits from OpenBSD’s top(1). I think it will be easier to understand, maintain and evolve.

I’d love some feedback from experienced OpenBSD people.

motet-a avatar Dec 16 '18 08:12 motet-a

Merged here: htop-dev/htop@78f4d06

natoscott avatar Aug 19 '20 23:08 natoscott