1752815 Members
6025 Online
108789 Solutions
New Discussion юеВ

Re: HP-UX Process Memory

 
Russell Cannon
New Member

HP-UX Process Memory

I am trying to ascertain how much memory is being used by a group of database processes; however, the shared TEXT region used by Oracle is included in every Oracle process (>2200 processes) even though there is only one copy of this region.

The ps command reports the total memory including shared text, which is about 400MB referenced, according to glance, by over 2,200 processes. The problem is that this shared text is included in sz and vsz by ps for each of those two thousand processes so that the total memory used is about five times (about 1000GB) physical memory (192GB) while glance reports only 79% of physical memory in use. The same TEXT memory region is being reported for every process that references it.

How can I get the PRIVATE memory used by a process in a script. (Note: I know that this can be seen in glance, but I need a non-interactive method.)

Cheers,
Russ
4 REPLIES 4
Dennis Handly
Acclaimed Contributor

Re: HP-UX Process Memory

>the shared TEXT region used by Oracle is included in every Oracle process even though there is only one copy of this region.

Yes, you need to make sure you count it only once.

>How can I get the PRIVATE memory used by a process in a script?

You'll probably have to write a program and call pstat_getprocvm(2) for each process and region.
Russell Cannon
New Member

Re: HP-UX Process Memory

Here is an example of ps output:

# UNIX95= ps -ef -o pid,sz,vsz,comm
PID SZ VSZ
11838 95215 381376 ora_e000_ORCL
3463 94995 381696 oracleORCL

Both processes above reference the same shared TEXT memory region so that the actual memory used by both processes combined is the shared TEXT region + each processes' private working set. There are 2,200 such processes supporting 74 databases in which the single shared TEXT region referenced by all processes is included in the SZ and VSZ values of each and every process.

The easy way, I suppose, is to just subtract the TEXT region from the VSZ of each process. I wonder how dynamic that TEXT region might be.

Cheers,
Russ
Don Morris_1
Honored Contributor

Re: HP-UX Process Memory

No promises on it being perfect (it was quick, and it certainly doesn't handle extended command lines for one thing), but from the sound of it what you need is to feed the script something that reports the pst_rssize field from pstat_getproc() [defined as the Private pages of the process, which would not include the text unless the process had Private/Writable text]. So, if that's all you need -- the attached will hopefully meet your needs to be run instead of ps.

Compile as:
cc +DD32 -D_PSTAT64 -o psish psish.c

(Or whatever name you pick instead of psish).

You could get more detailed summaries from the structure (such as real pages only for data or stack or sysV shmem, mmap, etc.) but this was what you asked for -- and it shouldn't be hard to extend if you wish.
Russell Cannon
New Member

Re: HP-UX Process Memory

Thanks. I will give this a try.