RE: [SLE] Difference in "ps -o pcpu" and top CPU percentage
On Wednesday, August 24, 2005 @ 8:57 PM, Richard Mixon wrote:
Greg Wallace mailto:jgregw@acsalaska.net scribbled on Wednesday, August 24, 2005 9:23 PM:
On Wednesday, August 24, 2005 @ 6:16 AM, Richard Mixon wrote:
Jerry Feldman mailto:gaf@blu.org scribbled on Wednesday, August 24, 2005 5:55 AM:
We noticed a significant different between the "percentage CPU" reported by TOP for a process (a Java instance of Tomcat) and that reported by issuing "ps -o pid,pcpu <process-id>". TOP indicated that the process was using 99% CPU, but "ps" just showed it using 40%.
I have google and googled, read the man/info pages - but cannot find any explanation for how they each arrive at their figures.
Any ideas or explanations are appreciated/welcome.
On Wednesday 24 August 2005 1:38 am, Richard Mixon (qwest) wrote: the top(1) command uses a sample and measures the percentage of elapsed CPU time between samples. PS is a single sample where percentage of CPU time is expressed in a ratio between "CPU time used divided by the time the process has been running".
Jerry, thanks - this sounds good. But if top is time averaging cpu usage, I would expect it to report a lower percentage cpu usage than ps does.We are seeing the opposite. BTW, this is a dual Xeon with hyperthreading turned on.
Any other ideas?
Thanks - Richard
ps could be lower if that process had just started. I. e., it could be a heavy load now, but not as related to your total usage for the session (right?).
Greg, good idea but unfortunately the process had been at 99% CPU usage in top for a number of minutes, but using ps it only showed 40%.
- Richard
So the ps % wasn't slowly creeping up over time? Greg Wallace
Greg Wallace mailto:jgregw@acsalaska.net scribbled on Wednesday, August 24, 2005 11:19 PM:
On Wednesday, August 24, 2005 @ 8:57 PM, Richard Mixon wrote:
Greg Wallace mailto:jgregw@acsalaska.net scribbled on Wednesday, August 24, 2005 9:23 PM:
On Wednesday, August 24, 2005 @ 6:16 AM, Richard Mixon wrote:
Jerry Feldman mailto:gaf@blu.org scribbled on Wednesday, August 24, 2005 5:55 AM:
We noticed a significant different between the "percentage CPU" reported by TOP for a process (a Java instance of Tomcat) and that reported by issuing "ps -o pid,pcpu <process-id>". TOP indicated that the process was using 99% CPU, but "ps" just showed it using 40%.
I have google and googled, read the man/info pages - but cannot find any explanation for how they each arrive at their figures.
Any ideas or explanations are appreciated/welcome.
On Wednesday 24 August 2005 1:38 am, Richard Mixon (qwest) wrote: the top(1) command uses a sample and measures the percentage of elapsed CPU time between samples. PS is a single sample where percentage of CPU time is expressed in a ratio between "CPU time used divided by the time the process has been running".
Jerry, thanks - this sounds good. But if top is time averaging cpu usage, I would expect it to report a lower percentage cpu usage than ps does.We are seeing the opposite. BTW, this is a dual Xeon with hyperthreading turned on.
Any other ideas?
Thanks - Richard
ps could be lower if that process had just started. I. e., it could be a heavy load now, but not as related to your total usage for the session (right?).
Greg, good idea but unfortunately the process had been at 99% CPU usage in top for a number of minutes, but using ps it only showed 40%.
- Richard
So the ps % wasn't slowly creeping up over time?
Greg, From what I can remember ... not really - maybe from 39.9 to 40.0 after a minute or two. I'll take a look at the -H option suggested in another post when I get to work. Thanks. - Richard
participants (2)
-
Greg Wallace
-
Richard Mixon (qwest)