I'm running a quite heavy number crunching thing on a few 4 core servers, all running Ubuntu Precise Pangolin LTS 64 bit, in the cloud (so I suppose in a virtualized environment).
To monitor the cpu usage, i wrote a .sh that uses "top -b -n 1" (that is a single run of top, only the first "frame") and merges it with some other data, to write a small report.
However, top always reported 64% idle on the cpus line, for each server, even if I was quite sure all four cores were 100% busy.
In fact, running top interactively, in the first frame it reports 64% idle time, but as soon as it refresh it reports correct (nearly 0% idle) data.
vmstat too, in the cpu column, always reports 64% idle time on the first line, and then starts reporting (supposedly) real data.
Why is it? Is it a bug in top/vmstat or in the kernel? Or is it a known side effect of how cpu % is measured? Why always 64%?
cpu load is instead always correct (around 4).