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 Wallace