Operating System - HP-UX
1833870 Members
1637 Online
110063 Solutions
New Discussion

How to list memory usage by process

 
SOLVED
Go to solution
Ahmed_58
Regular Advisor

How to list memory usage by process

Hi,

We are using HP-UX 11.00 how can i find memory usage (Mb used) for each process.

Ahmed
10 REPLIES 10
Arunvijai_4
Honored Contributor
Solution

Re: How to list memory usage by process

Hi Ahmed,

You can use UNIX95 variable with ps

# UNIX95= ps -ef -o sz,vsz,pid,comm

Also, Glanceplus will be helpful.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Arunvijai_4
Honored Contributor

Re: How to list memory usage by process

Hi Ahmed,

Also check this thread,

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=838754

(Geoff's script)

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Ahmed_58
Regular Advisor

Re: How to list memory usage by process

thanks Arun,
see below is the output so where is size of memory here taken by process? and can I sort it by higher usage?

SZ VSZ PID COMMAND
1098 4428 14256 cm
1410 7244 14892 cm_uat02
1098 4428 14251 cm

Ahmed
Muthukumar_5
Honored Contributor

Re: How to list memory usage by process

For calculating Mb you have to use specialised script.

Use this for reference:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1016659

get glance for feasible monistoring.

--
Muthu
Easy to suggest when don't know about the problem!
Arunvijai_4
Honored Contributor

Re: How to list memory usage by process

Hi Ahmed,

You can use this command as well,

UNIX95= ps -ef -o pid,ruser,vsz,args|sort -nrk3

Output will be sorted from High to low. These are in KB. You may need to convert them into MB for your need.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Muthukumar_5
Honored Contributor

Re: How to list memory usage by process

Use like,

UNIX95=1 ps -ef -o vsz= -o pid= -o comm= | sort -rnk1 | awk '{ print $1/1024" MB "$2" "$3; }'

will give MB size for memory usage.

--
Muthu
Easy to suggest when don't know about the problem!
Muthukumar_5
Honored Contributor

Re: How to list memory usage by process

Final better solution:

# UNIX95=1 ps -ef -o vsz= -o pid= -o comm= |sort -rnk1 | awk 'BEGIN{printf "Memory PID Process\n";}{ printf "%-3.2f MB %-5d %-15s\n",$1/1024,$2,$3; }'

--
Muthu
Easy to suggest when don't know about the problem!
Arunvijai_4
Honored Contributor

Re: How to list memory usage by process

Hi Ahmed,

Lot of threads have been discussed in the past about this, (memory usage by process)

http://www2.itrc.hp.com/service/james/search.do?todo=search&searchtext=memory+usage+by+process&from=forums&origin=0&submit.x=0&wpa=forums1.itrc.hp.com%3A80&submit.y=0&searchcategory=ALL&hpl=1&searchcriteria=allwords&rn=25&source=7000&chkServStor=on&presort=rank&esc=us.support.itrc.hp.com&admit=-1335382922+1144225378937+28353475

You can take a look at them for more information.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Ahmed_58
Regular Advisor

Re: How to list memory usage by process

Mathu & Arun,
Thanks very usful info. appreciate ur hep.
Ahmed
Ahmed_58
Regular Advisor

Re: How to list memory usage by process

bye for now.