Operating System - HP-UX
1836961 Members
2569 Online
110112 Solutions
New Discussion

Re: How to calculate user memory, system memory and buffer cache values?

 
Roger Jackson
New Member

How to calculate user memory, system memory and buffer cache values?

Can somebody please help me to determine user memory, system memory and buffer cache info, similar to what glance provides using the pstat functions or any other C functions (excluding system()). I want to be able to complete my C program (see attachment) to retrieve all this information without using sysdef, glance etc..

Thanks in advance for any assistance.
5 REPLIES 5
bhoopathi_1
Frequent Advisor

Re: How to calculate user memory, system memory and buffer cache values?

Try running dmesg command from root. Probably the output helps you.
Curtis Larson
Trusted Contributor

Re: How to calculate user memory, system memory and buffer cache values?

from: ftp://contrib:9unsupp8@hprc.external.hp.com/sysadmin/coolscripts/memsize.c

/* Get actual memory size in bytes */
#include
#include
main()
{
struct pst_static buf;
pstat_getstatic(&buf,sizeof(struct pst_static),1,0);
printf("%u\n",buf.physical_memory*buf.page_size);
}

Roger Jackson
New Member

Re: How to calculate user memory, system memory and buffer cache values?

1. Unfortunately, I'm not a system administrator and I don't have root access to run dmesg.

2. I have been able to determine the real physical memory in my 'C' program already (refer to original attachment). I just don't know which 'C' structures to use and/or calculations I need to perform to determine user memory, system memory and buffer cache values.

Any other ideas?
Suhas_2
Regular Advisor

Re: How to calculate user memory, system memory and buffer cache values?

Hi,
Pls try using "sar"...it has a wide variety of outputs....
Seconly "top" will also give you much information.
the typical uses are as below...
/bin/top -s 1
/bin/sar -k 2 2

I am searching more..as I know this might just not be suffice....;-))

Suhas.

Never say "Die"
Steven Sim Kok Leong
Honored Contributor

Re: How to calculate user memory, system memory and buffer cache values?

Hi,

Use adb to extract real-time kernel information (eg. real-time user memory, system memory and buffer-cache usage) ie. # adb -k /stand/vmunix /dev/mem.

Hope this helps. Regards.

Steven Sim
Brainbench MVP for Unix Admin
http://www.brainbench.com