RE: [SLE] Difference in "ps -o pcpu" and top CPU percentage
From: Greg Wallace (jgregw_at_acsalaska.net)
To: <email@example.com> Date: Wed, 24 Aug 2005 22:19:11 -0800
On Wednesday, August 24, 2005 @ 8:57 PM, Richard Mixon wrote:
>Greg Wallace <mailto:firstname.lastname@example.org> scribbled on Wednesday,
>August 24, 2005 9:23 PM:
>> On Wednesday, August 24, 2005 @ 6:16 AM, Richard Mixon wrote:
>>> Jerry Feldman <mailto:email@example.com> scribbled on Wednesday, August 24,
>>> 2005 5:55 AM:
>>>> On Wednesday 24 August 2005 1:38 am, Richard Mixon (qwest) wrote:
>>>>> 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
>>>>> 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.
>>>> 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?
-- Check the headers for your unsubscription address For additional commands send e-mail to firstname.lastname@example.org Also check the archives at http://lists.suse.com Please read the FAQs: email@example.com