CPU usage accuracy puzzlement
Hi fellas,
I'm trying to write a script to capture the CPU usage for a particular server. I have tried iostat, vmstat and top, but in batch mode they always give a consistent value. For example, if I just run 'iostat -c' once, it will return the same value, no matter how many times I run it. However, if I use 'iostat -c 1 5' for example, the first value returned will be that same value, but the remaining values will fluctuate wildly. The same behaviour is also observed with vmstat and top -b. Can anyone tell me whether this is normal behaviour? |
Yes, it's absolutely normal behavior.
And, in fact, a good (and often stated) rule of thumb is to *always* use "-5" (or "-3", or whatever you prefer), then always *disregard* the first value: http://perfhints.blogspot.com/2009/02/vmstat.html |
I don't know about the others, but for vmstat this behaviour is described on the man page.
Quote:
|
Thanks for the link, helped me loads.
:D |
All times are GMT -5. The time now is 12:15 AM. |