System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Getting RSS memory using ps command in HP UX 11.31

David_Ortiz
Occasional Advisor

Getting RSS memory using ps command in HP UX 11.31

Hello all,

 

this is my first post, so I hope to be well received here :)

 

I am trying to get a weekly report on the use of memory and CPU of different processes. So far I am using the ps command and redirecting the output to a file like this:

UNIX95=1 ps -ef -o pcpu,pid,args  | grep Dweblogic.Name=CitNave02 | grep -v grep >> /home/wlogic11/monitores_procesos/CitNave02_CPU

 

after that I process the file and I get the CPU of the process. However, I would also need the rss memory used by this process. I have checked the man of ps and found sz The size in physical pages of the core image of the process, including text, data, and stack space. 

 

But when using that parameter:

UNIX95=1 ps -ef -o pcpu,sz,pid,args | grep Dweblogic.Name=CitNave02 | grep -v grep
5.82 56348 19872 /opt/java6/jre/bin/IA64W/java -Dweblogic.Name=CitNave02 

I get 56348 pages, if I multiply that by 4K each page I obtain 225392Kb which is totally different from the output of the glance command for that process which is 1,59Gb :

Process Name     PID     Name   ( 400% max) Cnt  IOrate      RSS/VSS      On

java                     19872 wlogic11      3.1             55   0.0    1.59gb  3.11gb SLEEP

 

How can I obtaing the RSS value using ps command? I have found several responses over the internet where it use the argument "rss" but it this parameter doesn't appear at the ps manual. 

 

If there is no way to obtaing the RSS value using ps, any suggestion would be appreciated.

 

Thank you very much.

 

Kind regards.

 

David O.

 

 

5 REPLIES
Dennis Handly
Acclaimed Contributor

Re: Getting RSS memory using ps command in HP-UX 11.31

>If there is no way to obtaining the RSS value using ps, any suggestion would be appreciated.

 

What does vsz give?  A number 4 times smaller?

If you want RSS, perhaps you need to use  pstat_getprocvm(2).

David_Ortiz
Occasional Advisor

Re: Getting RSS memory using ps command in HP-UX 11.31

Hello Dennis,

if I use vsz in stead of sz I get approxymately the VSS
UNIX95=1 ps -ef -o pcpu,vsz,pid,args | grep Dweblogic.Name=CitNave02 | grep -v grep
2.71 3340484 19872 /opt/java6/jre/bin/IA64W/java

 

3340484/1024/1024= 3.18 Gb. At glance:

 

Process Name     PID     Name   ( 400% max) Cnt  IOrate      RSS/VSS      On

java                     19872 wlogic11      1.3            55   0.0       1.89gb /3.14gb SLEEP

 

This value is not useful to me, because this weblogic has configurated 2Gb of memory and VSS shows more memory used than this value. VSS shows the memory used by the process itself but also the memory that it shares with other processes while RSS shows the "real" used memory only by that process.

 

So, another solution would be to calculate the RSS using the VSS, but I haven't found any way neither.

 

Thank you, regards.

 

 

Dave Olker
HPE Pro

Re: Getting RSS memory using ps command in HP UX 11.31

Hello David,

 

Welcome to the community!

 

A couple of suggestions:

 

1) There is also a "vsz" parameter so you might get better results with that parameter

2) You are multiplying the "sz" parameter by 4K, which makes sense since that is the default page size. However, the base pagesize is tunable via the "base_pagesize" kctune parameter.  Are you certain your system is using a 4K pagesize?

 

Regards,

 

Dave

David_Ortiz
Occasional Advisor

Re: Getting RSS memory using ps command in HP UX 11.31

Hello Dave and thanks for the welcome,

 

I didn't realize that base_pagesize might be changed, but sadly I have checked and it is 4K so I don't understand why if I multiply the number of pages currently allocated in memory (parameter size of ps command) by 4K I am not getting the RSS parameter...

 

Regarding to the vsz, thank you but, as I said in my previous message, this parameter shows the total memory allocated by the process (its code, parameters, etc) but  in vsz it shows also some memory that the process has currently allocated but shared with other processes. At the example that I put it is very clear, I have a Weblogic process which shouldn't been allocating more than 2Gb (because it is configured like that) and the VSZ parameter is showing 3Gb while the RSS memory is less than 2Gb.

 

Thank for your reply, kind regards.