How to find the maximum CPU memory a process has used?
ZQH at psuvm.psu.edu
ZQH at psuvm.psu.edu
Fri Jun 28 06:22:00 AEST 1991
Hi, NetWorld. This is my FIRST netnews post.
As you know, the RISC Unix workstations becomes more and more affordable
and powerful. As a result, more and more people move their engineering
applications from mainframes (like CRAY-YMPs & IBM3090s) to those
powerful workstations. As some of you may have noticed, one of the
major differences between mainframes and workstations is, on the
workstation, the available CPU memory is much less than the one
on the mainframe. So it is important to know & control the CPU
memory, especially the maximum memory, your applications have used.
On the Unix system, there is a command "ps" for us to find some
informations about the CPU memory the processes are using (i.e.,
the INSTANTANEOUS memory at the given moment). However, it is
the maximum CPU memory usage which determines if the specific
engineering application is able to run on certain workstations.
I understand there is a way to search for the maximum CPU usage
by using another background process to check "ps" periodically:
#!/bin/sh
#
touch ps.list
#
while ps -ux | grep app.out > /dev/null
do
ps -ux | grep app.out >> ps.list
sleep 10 # whatever period you prefer
done
By doing so, you may or may not find the maximum CPU memory usage
AND you have to look through tons of data for it.
I checked the man page for csh ("man csh") the other day and I found
something very interesting. Under the section of "Enviromental
Variables and Predefined Shell Variables", there is something about
setting automatic timing threshold and timetags for various output,
one of them is the maximum CPU memory usage! It's something like:
set time = "1 '%U %S %E %P %M'"
However, I tried it several times without sucesses.
It only gave you the usual output from automatic timing
(in the man page, it says the default timetag format doesn't
including '%M', which displays the maximum CPU memory usage).
The default output is as followings:
179.1856u 31.6673s 7:19 47%
I guess probably I didn't set something properly.
I think, in the NetWorld, there are a lot of Unix experts, who
are much more knowledgeable about the UNIX than I (I used to
use the IBM VM/CMS system and started learning Unix not long ago).
You may send the response via e-mail to me. I'll try to post
a summary in the newsgroup 'comp.unix.questions'.
FYI, you can find the automatic timing under the section of
"Enviromental Variables and Predefined Shell Variable" in
the 'man csh' (near the end of it) and you have to be on
the SUN OS 4.1.
If you need further information, please let me know.
Thanks a lot in advance.
James
Name: Zhijun James Huang
BITNet: zqh at psuvm
Internet: huang at prandtl.che.psu.edu
or zqh at psusun03.psu.edu
More information about the Comp.sys.sun
mailing list