Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 555630

Summary: sys-process/htop - broken CPU accounting for host virtual machines
Product: Gentoo Linux Reporter: kfm
Component: Current packagesAssignee: Christian Ruppert (idl0r) <idl0r>
Status: RESOLVED OBSOLETE    
Severity: major CC: jstein, polynomial-c
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://github.com/hishamhm/htop/issues/202
Whiteboard:
Package list:
Runtime testing required: ---

Description kfm 2015-07-22 13:05:00 UTC
I have noticed that htop reports CPU usage in a way that is inaccurate and inconsistent with other tools. Among the symptoms I have noticed is that that 100% usage is falsely reported for random cores across each delta. This appears to hold true whatever the value of the --delay parameter.

Someone else noticed and has reported it upstream.

  https://github.com/hishamhm/htop/issues/202

As stated there, the problem was introduced at some point after the 1.0.1 release. I checked the master branch, which is also affected. I intend to bisect this, as time permits.

In the meantime, please restore 1.0.1 to portage and consider revoking the stable keywords for later versions until the issue can be addressed. The justification for this is that htop is very popular and it is of considerable importance that such tools convey proper data.
Comment 1 kfm 2015-07-24 01:33:43 UTC
Further investigation indicates that this issue might be limited to systems running host virtualization software, although I am still waiting for upstream to confirm. My most recent comment in the upstream issue is quoted beneath.
---

Bisection reveals the following commit as being responsible.

af285d1 Fixes in accounting of guest time when using virtualization

The box that I am testing is a Linux KVM host - not a guest. The option to add guest time to the CPU meter is disabled.

[ ] Add guest time in CPU meter percentage

If I understand this correctly, this commit is either intended to improve the accuracy of CPU accounting in a guest or pertains to the above mentioned option. Either way, it seems to be responsible for inaccurate readings on the host.
Comment 2 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2022-01-14 09:05:11 UTC
This has long been fixed by upstream