Operating System - HP-UX
1833861 Members
2425 Online
110063 Solutions
New Discussion

process memory utilization???

 
SOLVED
Go to solution
Alan Meyer_4
Respected Contributor

process memory utilization???

How can I find out how much memory a particular process(PID) occupies?
" I may not be certified, but I am certifiable... "
16 REPLIES 16
Gavin Clarke
Trusted Contributor

Re: process memory utilization???

Do you have glance? In which case RSS gives a good indication I believe.

There is alot of content on the forums about this already.
Alan Meyer_4
Respected Contributor

Re: process memory utilization???

... from the command line as part of a script???
" I may not be certified, but I am certifiable... "
Alan Meyer_4
Respected Contributor

Re: process memory utilization???

can You supply a PID number to Glance in adviser mode and get the util back?
" I may not be certified, but I am certifiable... "
Alex Lavrov.
Honored Contributor
Solution

Re: process memory utilization???

export UNIX95=1


Then "ps -ef -o sz,vsz | grep ".

Read man for more options in XPG4 mode.

Alex.
I don't give a damn for a man that can only spell a word one way. (M. Twain)
Gavin Clarke
Trusted Contributor

Re: process memory utilization???

Gavin Clarke
Trusted Contributor

Re: process memory utilization???

Funny,

The thread I linked to was posted by Alex!

Cheers.
James R. Ferguson
Acclaimed Contributor

Re: process memory utilization???

Hi Alan:

Two easy ways are with 'glance' or simply with 'ps'.

For instance, to find the virtual size ('vsz' in kilobytes), along with the user, parent pid and command line used to start the process, for pid-1593 do:

# UNIX95= ps -p 1593 -o "user,vsz,pid,ppid,args"

Note that there is NO space between 'UNIX95=' and the 'ps' command. This syntax sets the UNIX95 variable ONLY for the duration of your commannd line. It arms the XPG4 behavior. You don't want it to "stay around" in your environment necessarily, so don't export it.

See the manpages for 'ps' for more information.

Regards!

...JRF...

Alan Meyer_4
Respected Contributor

Re: process memory utilization???

ok, so how does the vsz*4 value compare to the RSS value found in Glance?

here's the results I get.

#UNIX95= ps -p 11274 -o vsz,pid,args
VSZ PID COMMAND
26684 11274 /opt/Indicative/jre/HPUX11/jre...


From Glance I get this
Process Name PID PPID Pri Name ( 200% max) CPU IO Rate RSS Cnt
--------------------------------------------------------------------------------
java 11274 1 168 root 0.7/ 3.4 84.1 0.0/ 0.4 80.4mb 47

So, 26684 * 4 = 106736kb

and from Glance RSS = 80.4mb Are they suppose to compare?
" I may not be certified, but I am certifiable... "
Alex Lavrov.
Honored Contributor

Re: process memory utilization???

vsz - virtual size, also the size that swapped out or deactivated.
rss - resident size, the size in the memory.

try to replace the vsz -> sz and I think you'll get close results.

Alex.
I don't give a damn for a man that can only spell a word one way. (M. Twain)
Alan Meyer_4
Respected Contributor

Re: process memory utilization???

Nope,

UNIX95= ps -p 11274 -o sz,pid,args

yields

SZ PID COMMAND
6411 11274 /opt/Indicative/jre/HPUX11/jre1...

and 6411 * 4 = 25644

???
" I may not be certified, but I am certifiable... "
James R. Ferguson
Acclaimed Contributor

Re: process memory utilization???

Hi (again) Alan:

The computations are not done exactly the same for both probes.

'glance' includes any shared memory regions and/or shared library regions in its RSS value in addition to the stack, text and data region totals of the process. 'ps' does not.

The units for 'vsz' are 1024 byte chunks. If you use 'sz' then the units are PAGE_SIZE chunks (generally 4096).

To see you PAGE_SIZE, do:

# getconf PAGE_SIZE

Regards!

...JRF...
Alan Meyer_4
Respected Contributor

Re: process memory utilization???

Ok, thanks.

And thanks to all for the assistance....
" I may not be certified, but I am certifiable... "
generic_1
Respected Contributor

Re: process memory utilization???

glancepluss can be usefull too too :)
Alex Lavrov.
Honored Contributor

Re: process memory utilization???

Hmm, so the only difference between "sz" and "vsz" is the measuring units?

Alex.

(zero plz)
I don't give a damn for a man that can only spell a word one way. (M. Twain)
Alex Lavrov.
Honored Contributor

Re: process memory utilization???

http://nixdoc.net/man-pages/HP-UX/man1/ps.1.html

Yep, looks the same. Everyday you learn something new.

And vsz and sz are the same if you calculate ~25MB. Like it was said, without shared memory and other stuff, only core image of the proc.

Alex.
I don't give a damn for a man that can only spell a word one way. (M. Twain)
Alan Meyer_4
Respected Contributor

Re: process memory utilization???

close thread
" I may not be certified, but I am certifiable... "