ps -o and Process CPU Time

This is a discussion on ps -o and Process CPU Time within the Linux Administration forums, part of the Linux Forums category; Hi Folks, I have a question regarding how `ps -o cputime` reports CPU time for a process. This is on ...


Go Back   Usenet Forums > Linux Forums > Linux Administration

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-04-2006
Josh Birnbaum
 
Posts: n/a
Default ps -o and Process CPU Time

Hi Folks,

I have a question regarding how `ps -o cputime` reports CPU time for a
process.
This is on an HP DL-380, 4 x Xeon@3.2GhZ, 4096 Mbytes main memory,
SLES9,
service pack 2, stock SLES9 kernel 2.6.8 (if memory serves).

Specifically, I have multiple Java virtual machines (Sun Java JRE-1.5.0)
running on a system (in the form of a Java browser plugin) and I wish to
calculate total CPU time
for all running JVMs.
I have a Perl script that calls `ps -o cputime,...` in a loop that iter-
ates for as many times as there are JVMs running. Each time through the
loop, I get the CPU time for the JVM process that the loop is currently
looking at and add it to a running total.

What I want to do is clarify that I can get accurate results via this
method - that `ps` output is accurate and representative of total JVM
CPU
expenditure. Is this the case?

One other thing. When exporting $DISPLAY from the DL-380 to, say, 9
remote
X servers and starting 9 different browser sessions on those remote
disp-
lays, `ps -e | grep java_vm | wc -l` often reports 200+ instances of
running java_jvm.
I'm guessing that what I'm seeing here is the JRE spawning threads like
crazy. Does this sound normal?

I would also want to do the above CPU time calculation with ps for
Firefox- 1.5 and Mozilla-1.7.8 running on the same system.

Any feedback would be appreciated.

Thanks,

Josh.
Reply With Quote
  #2 (permalink)  
Old 04-05-2006
Unknown
 
Posts: n/a
Default Re: ps -o and Process CPU Time


> looking at and add it to a running total.


Whats wrong the CPU used time in top ?

"top -c" for example, try sorting by user or group.

For example my X server has used 535mins, 13.4 seconds of CPU time in
uptime (10 days 16 hrs)

4139 root 15 0 207m 152m 6560 S 0.7 10.0 535:13.14 /usr/X11R6/bin/X :0 -ac -audit 0 -auth /var/gdm/:0.Xauth vt7

Jon


Reply With Quote
  #3 (permalink)  
Old 04-09-2006
Josh Birnbaum
 
Posts: n/a
Default Re: ps -o and Process CPU Time

Hi Jon,

> > looking at and add it to a running total.

>
> Whats wrong the CPU used time in top ?
>
> "top -c" for example, try sorting by user or group.


Thanks for the example. I should have added that I had already
started my CPU time data collection using ps at the time of my
original post. So, I'd still like to confirm that ps will do
the job.

How about this, though (from my initial post):

> One other thing. When exporting $DISPLAY from the DL-380 to, say,
> 9 remote X servers and starting 9 different browser sessions on
> those remote displays, `ps -e | grep java_vm | wc -l` often reports
> 200+ instances of running java_jvm.
> I'm guessing that what I'm seeing here is the JRE spawning threads
> like crazy. Does this sound normal?


Do you have any insight as to whether the above is normal?

Thanks,

Josh.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:08 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0