PikK45
April 3, 2013, 6:31am
1
Hi Guys,
I have a script. It calls an executable inside (programmed in C). I will have to find the execution time of that script and amount of memory consumed by that process as well.
#!/bin/sh
echo "Script starting"
echo "executable staring"
executable parm1 parm2 parm3
echo "executable completed"
echo "Script completed"
exit
I know time ./script.sh
will give me the execution time of this. What I would want to know is the total memory(RAM) and %CPU utilized by this as well.
System Details:
HP-UX
B.11.23
Yoda
April 3, 2013, 10:12am
2
Capture the PID of your executable, then use ps
to check CPU & MEM:
UNIX95=1 ps -ef -o pid,pcpu,vsz,comm | grep <PID>
Yoda
April 3, 2013, 12:01pm
4
Yes, -o
is an illegal option when you simply run ps
on HP-UX.
So you have to set UNIX95 variable to use the XPG4 environment instead of the HP-UX environment.
$ UNIX95=1 ps -ef -o pid,pcpu,vsz,comm | grep init
1 0.40 852 init
23 0.05 0 pagetableinit_daemon
$ uname
HP-UX
PikK45
April 4, 2013, 5:51am
5
Thanks, Yoda
pid -- process id
pcpu -- CPU utility%
vsz -- memory usage? in KB or MB?
comm -- command