Operating System - HP-UX
1833324 Members
3122 Online
110051 Solutions
New Discussion

how to get "RES" of mem from unix95 ps

 
Gary Yu
Super Advisor

how to get "RES" of mem from unix95 ps

Hi all,

I'm writing a script to poll process informations using unix95 ps, I know that

with UNIX95= ps -eo 'vsz pid ...' I can get the memory size of a process like the "SIZE" column in top, but is there a option with unix95 ps that I can get the "RES" column in top?

thanks,
Gary
3 REPLIES 3
Steve Steel
Honored Contributor

Re: how to get "RES" of mem from unix95 ps

Hi


There is no option to give the res column.

However top has an undocumented -f file
option so if you need it do

top -d1 -n256 -f /tmp/toplis

And you have your machine in top format in file
/tmp/toplis where you can extract your data


steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Stefan Farrelly
Honored Contributor

Re: how to get "RES" of mem from unix95 ps

Steve's answer is spot on. But remember, the RES total isnt 100% accurate. If you add up the RES column for all running processes then it may be much much larger than it should be (ie. glance/gpm will differ) thats because RES doesnt take into account shared memory areas, shared memory, semaphores etc etc. The only way to get really accurate memory sizes is to use glance or gpm and look at a processes memory regions individually to get the exact total.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Steve Steel
Honored Contributor

Re: how to get "RES" of mem from unix95 ps

Hi


For real neatness look at glance plus in adviser syntax


To run glance in the background against special adviser syntax,
logging data to a file, you must first create a file that contains the
appropriate adviser commands, then execute glance with stdout
redirected to a file. For example,
echo 'print gbl_stattime, " runq=", gbl_run_queue' >temp
glance -adviser_only -syntax ./temp -j 60 >outfile &

Then you can log data on almost anything


steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)