ps -o and Process CPU Time - Linux
This is a discussion on ps -o and Process CPU Time - Linux ; 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 ...
-
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.
-
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
-
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.