Operating System - HP-UX
1831554 Members
4185 Online
110025 Solutions
New Discussion

Re: Process related memory

 
Sonison James
Frequent Advisor

Process related memory

Hello,

I would like to know the following about a process:
1. Physical memory
2. Shared memory
3. Virtual memory
4. Virtual shared memory

Any pointers will be really helpful.

Thanks and regards
Sonison James
6 REPLIES 6
Con O'Kelly
Honored Contributor

Re: Process related memory

Hi

Glance is the best tool for this. If you don't have it installed you can get a 60 day free trial. Its on the application CD's.

Alternatively use:
# UNIX95= ps -el -o pid,comm,sz,vsz| grep -i -v pid | sort -nr -k 3,3 |head -15

This will give you the top 15 memory usage processes.

Other useful commands/tools:
# ipcs -mob
Shows shared memory utilisation.
Also have a look at shminfo utility. This does come with HP-UX but can be downloaded from the internet.

Cheers
Con
Con O'Kelly
Honored Contributor

Re: Process related memory

Sorry, meant to say shminfo does not come with HP-UX.

Download shminfo from:
ftp://hprc.external.hp.com/sysadmin/programs/shminfo/

Cheers
Con
twang
Honored Contributor

Re: Process related memory

process size:
# UNIX95= ps -eo "pid ruser pcpu vsz=Kbytes" -o comm
Note:
vsz: The size in kilobytes (1024 byte units) of the core image of the process. See column sz, above.
Sonison James
Frequent Advisor

Re: Process related memory

Hello,

I am sorry, I forgot to mention that I would like to find the information programatically. I found a structure "pst_status" that is populated by pstat_getproc(), but I am not sure if it returns what I am looking for.

Thanks and regards
Sonison James
twang
Honored Contributor

Re: Process related memory

#include
#include

main (argc, argv)
int argc;
char *argv[];
{
struct pst_status pst;
int target = atoi(argv[1]);

if (pstat_getproc(&pst, sizeof(pst), (size_t)0, target) != -1)
{
(void)printf("Process %d started at %sand size is %d\n", target, ctime(&pst.pst_
start), sizeof(pst));
}
else
{
perror("pstat_getproc");
}
}
Mike Stroyan
Honored Contributor

Re: Process related memory

Here are a couple examples that report process sizes using pstat functions. The procvm_sizes.c program reports absolute sizes of all regions.

The procvm_sizes_glance.c program discounts the physical memory size of shared memory segments. It divides those sizes by the total number of references to each shared memory region by all processes on the system. That mimics the way that glance reports shared memory sizes.