Operating System - Linux
1748227 Members
4463 Online
108759 Solutions
New Discussion

Re: wrong data in pstat_getproc

 
SOLVED
Go to solution
Aurelio Rodriguez_1
New Member

wrong data in pstat_getproc

in top (for HPUX) one process has an amount of virtual memory and a resident set size of memory.
example:

CPU TTY PID USERNAME PRI NI SIZE RES STATE TIME %WCPU %CPU COMMAND
0 pts/tf 13269 hpfms 152 20 42400K 8116K run 0:00 14.47 2.02 fmsarchive_server.exe

With pstat_getproc the results for this pid is:

8116 for
t->rss = pst[i].pst_rssize<5196 for t->size = (pst[i].pst_tsize + pst[i].pst_dsize + pst[i].pst_ssize)<for virtual

what happens? and why?

I compile with:
#if !defined(_PSTAT64)
#define _PSTAT64
#endif

and in compiler:
CDEFS = -O -Ae -D_PSTAT64

thanks in advance
1 REPLY 1
Don Morris_1
Honored Contributor
Solution

Re: wrong data in pstat_getproc

Well, first of all -- you aren't adding the virtual in what you stated. pst_tsize, pst_dsize and pst_ssize are the resident (physical) sizes of Text, Data and Stack respectively. So all your calculation above indicates is that about 2,920K [assuming you're outputting K.. if you were really shifting by pageshift, your calculation should be producing an amount in bytes.. so your "pageshift" is probably "bytes per page / 1024"] of the physical memory used by this process is either MMAP, SysV shared memory, UAREA or if you're on IPF in the RSE Stack. [MMIO is the other one, and MMIO by definition shouldn't have a RSS component].

If you want virtual, you need to look at pst_vtsize, pst_vdsize and pst_vssize. However -- that still wouldn't add up... because a process isn't only Text+Data+Stack. Your virtual total should also include pst_vmmsize (MMAP), pst_vshmsize(SysV Shmem) and pst_vusize (thread UAREAs). Include pst_vrsesize for the RSE stack on IPF if need be.