top utility: initial display shows incorrect CPU utilization data
Distros:
Redhat (2.6.18-128.2.1.el5 #1 SMP Wed Jul 8 11:54:47 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux)
Ubuntu (2.6.24-24-386 #1 Tue Aug 18 16:24:26 UTC 2009 i686 GNU/Linux)
When I run 'top' in batch mode (specifying 1 iteration), the CPU % idle (%id) value is always the same and not accurate. Even when in interactive mode, the initial data display has incorrect CPU %id data. In interactive mode, the CPU %id value gets updated and by the third or fourth iteration, it looks to be accurate.
I installed the sysstat package on both systems. Using 'mpstat', the CPU utilization percentages don't match what 'top' displays in interactive mode. I can have two shells side-by-side, one with top in interactive mode and one running 'watch -n 3 mpstat'. They are both updating every 3 seconds, but the CPU utilization data is different for each.
Why is the first CPU utilization displayed by 'top' inaccurate?
Between 'top' and 'mpstat', which is most accurate/reliable?
Is there a better utility to fetch CPU utilization data?
Is there a reasonable way for me to calc my own CPU utilization data from /proc/stat?
|