Find memory usage along with time


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Find memory usage along with time
# 1  
Old 04-03-2013
HP Find memory usage along with time

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.

Code:
#!/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
# 2  
Old 04-03-2013
Capture the PID of your executable, then use ps to check CPU & MEM:
Code:
UNIX95=1 ps -ef -o pid,pcpu,vsz,comm | grep <PID>

# 3  
Old 04-03-2013
-o Not recognized...!!! Smilie Smilie
# 4  
Old 04-03-2013
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.
Code:
$ UNIX95=1 ps -ef -o pid,pcpu,vsz,comm | grep init
    1  0.40     852 init
   23  0.05       0 pagetableinit_daemon

Code:
$ uname
HP-UX

# 5  
Old 04-04-2013
Thanks, Yoda Smilie

Code:
pid -- process id
pcpu -- CPU utility%
vsz -- memory usage? in KB or MB?
comm -- command

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Find memory usage for a process

I have multiple oracle databases on one server. All the database are running from the same user i.e. oraent. The process for each database can be distinguished by the ps -ef command Eg : ps -ef | grep oraentThe Output : oraent 5361 1 0 20:58:05 ? 0:00 oracledb1... (11 Replies)
Discussion started by: yashreads
11 Replies

2. Solaris

How to find out the memory usage in Solaris?

Hi All, In one of the solaris box aslert got triggered as ... (Used_Real_Mem_Pct=93.0 Used_Swap_Space_Pct=75.0 )] when i see the usage by vmstat and sar i am not able to relate the alert with the free memory and swap memory please help to understand the vmstat output as below.. kthr ... (4 Replies)
Discussion started by: Riverstone
4 Replies

3. UNIX for Dummies Questions & Answers

Memory usage per user,percent usage,sytem time in ksh

Let's say i have 20 users logged on Server. How can I know how much memory percent used each of them is using with system time in each user? (2 Replies)
Discussion started by: roy1912
2 Replies

4. Shell Programming and Scripting

To find JVM memory usage in shell console

i need to find memory usage by JVM in shell prompt, i tried with pidVal=$( ps -ef | grep "/opt/bea2/jrockit/bin/java -jrockit" | grep -v grep | awk -F' ' '{print $2}' | tr "\n" "," | cut -d ',' -f1 ) top -b -n 1 | grep $pidVal this will just give cpu usage and ram... How do i find... (4 Replies)
Discussion started by: vivek d r
4 Replies

5. UNIX for Dummies Questions & Answers

Command to display the space usage (memory usage) of a specific directory.

Hi all, Can you please tell me the command, with which one can know the amount of space a specific directory has used. df -k . ---> Displays, the amount of space allocated, and used for a directory. du -k <dir name> - gives me the memory used of all the files inside <dir> But i... (2 Replies)
Discussion started by: abhisheksunkari
2 Replies

6. UNIX for Advanced & Expert Users

How to find out memory & cpu usage of a process

Hi, By using time command we can determine the execution time of a process or command. bash-2.04$ time ls -l total 0 -rw-r--r-- 1 admin tac 0 Oct 6 04:46 file1 -rw-r--r-- 1 admin tac 0 Oct 6 04:46 file2 real 0m0.002s user 0m0.000s sys 0m0.001s... (5 Replies)
Discussion started by: learn more
5 Replies

7. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

8. Solaris

current CPU usage, memory usage, disk I/O oid(snmp)

Hi, I want to monitor the current cpu usage, monitor usage , disk I/o and network utlization for solaris using SNMP. I want the oids for above tasks. can you please tell me that Thank you (2 Replies)
Discussion started by: S_venkatesh
2 Replies

9. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

10. Programming

Monitor CPU usage and Memory Usage

how can i monitor usages of CPU, Memory, Hard disk etc. under SUN Solaries through a c program or java program i want to store that data into database so i can show it graphically thanks in advance (2 Replies)
Discussion started by: Gajanad Bihani
2 Replies
Login or Register to Ask a Question