We need to capture CPU utilization while load run of our testing in different environments (solaris, Linux, AIX) with single or multi cpu's.
In Solaris, presently we are capturing CPU utlization using prstat.
In Linux there are many commands like vmstat, mpstat, top, sar etc.
Which is the best and reliable command?
Software/Hardware used:
ASKED:
November 21, 2008 2:44 PM
UPDATED:
December 1, 2008 3:59 PM
On linux, we use “top”, and it has been very useful and reliable, And for Solaris, we use prstat too.
Regards,
In linux, i used the followin command for CPU utilization.
ps -eo pid,pcpu,args |grep <process name>
But many people think that this will not give correct CPU utilization. Any reason for this ?
I think that is because the CPU usage from ps is not the “current” CPU usage, but an average.
This is from an Ubuntu man page:
“CPU usage is currently expressed as the percentage of time spent running
during the entire lifetime of a process. This is not ideal, and it does not
conform to the standards that ps otherwise conforms to. CPU usage is unlikely
to add up to exactly 100%.”
and this from other linux man page:
“%CPU shows the cputime/realtime percentage. It will not add up to 100% unless you are lucky. It is time used divided by the time the process has been running. “
In Intel Core Duo, the percentage of CPU utilization by top command shown as more than 100% (200%, etc). Why?
I think it is because it sees the core duo as if it has two processors.
How does it show CPU usage if you turn off the “single cpu” mode, by pressing the “1″ key ?