[ale] Best command for cpu utilization

Michael D. Hirsch mhirsch at nubridges.com
Tue Jan 7 10:46:07 EST 2003


On Tuesday 07 January 2003 08:50 am, Mike Millson wrote:
> What is the best command to get cpu utilization? When I run iostat or
> vmstat, it shows idle cpu at 14%. When I run top it initially shows idle
> cpu at 5.7%, then changes to 98.0%.
>
> Why does top show a low number initially then quickly display a new
> number that is very different?

I've always assumed it is that top is not very clever.  top refreshes 
itself every 5 seconds, so the numbers yuo see are averages over those 5 
seconds.  But it doesn't wait 5 seconds to show it's first screen.  So 
that screen is not averaged, or not averaged correctly.  I haven't read 
the code, but I can imagine all sorts of ways to get bad data.  For 
instance, if it counts idle cpu cycles and divides by 5 seconds, even 
though it's only been 1 second, you could get the wrong amount of idle 
cpu.  Another possibility is that top itself typically chews up around 5% 
of the cpu, but that 5% is spread over 5 seconds.  If it uses that same 5% 
in a half second, top will be using 50% of the cpu.

I pretty much ignore top until the first time it refreshed.

> Why do top and iostat/vmstat show numbers that are so different?
>
> Why do iostat and vmstat show numbers that don't add up to 100%?

Sorry, can't help you there.  Some would say I wasn't helpful above, 
either.

My favorite tool is xosview, though that is a graphical tool.

--Michael
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale






More information about the Ale mailing list