%cpu differences between sar and top
ESGLinux
esggrupos at gmail.com
Tue Nov 24 16:39:28 UTC 2009
Hello,
I´m checking the performance of one RHEL running a java process and I use
the sar command and the top command to see the cpu usage and I get some
differences that I don´t understand.
First I´ll tell you how I check it:
for the sar command I run this:
sadc -F -L 1 1000 /home/user/log/output
for top I run this:
top -b -d 1 -n 1000 -p $PID
PID is the PID of my java process.
Well, when I run this I get this results:
PM CPU %user %nice %system %iowait %idle
07:09:09 PM all 35.75 0.00 7.25 0.00
57.00
07:09:11 PM all 50.00 0.00 13.43 0.00
36.57
07:09:13 PM all 23.56 0.00 7.27 0.00
69.17
07:09:15 PM all 36.75 0.00 8.00 0.00
55.25
07:09:17 PM all 66.08 0.00 10.22 0.25
23.44
07:09:19 PM all 31.17 0.00 6.23 0.00
62.59
top
TIME PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
19:09:09 26314 user 16 0 817m 324m 36m S 99.9 8.6 0:44.11 java
19:09:11 26314 user 16 0 817m 382m 36m S 99.9 10.1 0:46.70 java
19:09:13 26314 user 16 0 817m 381m 36m S 99.9 10.1 0:48.02 java
19:09:15 26314 user 16 0 828m 392m 36m S 99.9 10.4 0:49.95 java
19:09:18 26314 user 16 0 817m 398m 36m S 95.8 10.6 0:52.16 java
19:09:20 26314 user 16 0 817m 398m 36m S 51.9 10.6 0:54.20 java
with sar I never reach the 99,9% of CPU but with top I see this amount of
CPU in several times.
So, which is the true value of CPU usage? and why this differences?
thanks in advance
ESG
More information about the redhat-list
mailing list