[Haifux] CPU usage percentage doesn't add up

guy keren choo at actcom.co.il
Fri Feb 25 17:48:00 MSK 2011


tell him, when running 'top', to press '1' (so he'll see the CPU usage
percentage for each core separately), and then to press 's1' - so the
screen will refresh every second, instead of every 3 seconds.

this might change what he sees.

another thing - what does he call "CPU usage"? 'top' separate this into
several types - user space usage, system (kernel code) usage, I/O wait
time (during which the CPU is in fact not doing anything), and time to
handle hardware and software interrupts.

the idle time is 100% minus all the values mentioned above.

i am not sure which of these values are accumulated in the per-process
CPU usage.

--guy



On Fri, 2011-02-25 at 16:37 +0200, Ohad Lutzky wrote:
> Hello all,
> 
> 
> A peer of mine is developing a multi-platform C++ application, and
> would like to test the CPU usage difference of the application between
> Windows and Linux. However, running `top` shows him that his single
> process is using 20% CPU, whereas the total CPU usage is only 0.5%-2%.
> This is a quad-core machine, so even dividing the 20% by 4 will give
> 5%, which is still far too high. Windows gives him a satisfactory
> measurement of this statistic. Can anyone here explain why this
> happens?
> 
> -- 
> Man is the only animal that laughs and weeps, for he is the only
> animal that is struck with the difference between what things are and
> what they ought to be.
>  - William Hazlitt
> 
> Ohad Lutzky
> 
> _______________________________________________
> Haifux mailing list
> Haifux at haifux.org
> http://hamakor.org.il/cgi-bin/mailman/listinfo/haifux





More information about the Haifux mailing list