Why do the progress meters across the top of the screen in htop show CPU usage consistently above >90% while the numbers in the table below show a nearly idle system with CPU usage and load average at 0.0%?

partial htop screen grab

  • 1
    I have the exact same issue and I am also on a Dreamhost VPS (virtual private server). – duality_ Jan 30 '13 at 22:22
  • BTW, look at my example, it's even worse: demo.ddesign.si/temp/dh3.png – duality_ Jan 31 '13 at 22:06

htop is unaware it is running on a kernel level virtualized environment (Dreamhost VPS is using VServer technology). It is then showing the CPU usage for all the OS instances sharing the same kernel, not just yours.

Have a look to vtop output which sho ws all processes sharing the CPUs, not just the ones in your container.

If vtop is not installed, and this is probably expected for a commercial solution as one wouldn't like to a customer to see what processes are running other customers, there is no way to fix the issue from inside your container, unless patching top source to compute CPU usage instead of getting it from the kernel statistics.

It might do it by summing up CPU usage of all the processes running in your VServer, e.g.:

ps aux | awk '
    {cpu+=$3; ram+=$6} 
    END {printf("cpu: %d%%, RAM: %.2f MiB\n",cpu,ram/1024) }'
  • +1 for the explanation; top reports similarly to htop on this machine. Vtop not tested as not installed. Marking this as accepted because it answers "why?", though it doesn't address the implicit "and what can be done about it?", as that was unspoken – matt wilkie Mar 22 '13 at 17:49

This sort of inconsistency is usually indicative of high processor usage by kernel threads, which aren't displayed in htop by default. To display them, in htop go to Setup, then Display options, and then uncheck Hide kernel threads. This should allow you to see the thread(s) that are responsible.

You can also disable this behaviour by setting hide_kernel_threads to 0 in ~/.htoprc.

  • 2
    thanks Chris. I did that but the table values are still 0%. Maybe this is something peculiar to running in a virtual machine? The host is Virtual Private Server (on Dreamhost.com). – matt wilkie Feb 17 '12 at 21:37
  • For me, this is the more correct answer. I had a process that was taking up a lot of CPU from the kernel, and it wasn't showing up in the user space processes. – Patrick Chu Dec 20 '16 at 17:07
  • ...except that the HTop CPU meters show kernel time in red and user time in green, and we can clearly see it's nearly all green. – MathematicalOrchid Feb 18 at 12:01

Try launching htop with sudo. You need root access to see those active threads in the table.

  • I don't know how well or not this works on regular virtualized environments, if there is such a thing as regular, but doesn't work on dreamhost VPS. – matt wilkie Mar 22 '13 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.