1833946 Members
1796 Online
110063 Solutions
New Discussion

Re: physical memory

 
SOLVED
Go to solution
u856100
Frequent Advisor

physical memory

Hi all,

I have just been browsing the thread below regarding finding the physical memory on a system.

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x93f6a12d6d27d5118fef0090279cd0f9,00.html

The range of varying answers that I have got is plentiful. For example using SAM to display memory presented 4Gig which is about right for my system. However, when I use the /usr/sam/lbin/getmem command I get 120 (meg I assume as it does not display a metric).

I have also got other disparate results.

Could anyone explain this fluctuation of executable methods?

thanks for your help,

John
chicken or egg first?
6 REPLIES 6
Carlos Fernandez Riera
Honored Contributor

Re: physical memory

1- getmem dont work for systems upper 512M?

2-Unix systems must be loaded on memory, so ther is differences among Physical and usable, and lockable memory.

3- See man pstat. Pay atention to examples.

4- Search "how much memory"... lots of questions have been answered.
unsupported
Steve Steel
Honored Contributor
Solution

Re: physical memory

Hi

getmem returns a number used in a larger calculation and the other disparencies can be caused by many things.

Use SAM or this 2 line script for a quick guide.

There as well you will see discrepencies caused by rounding.


typeset -i mem=$(grep Physical /var/adm/syslog/syslog.log | awk '{print $7}')
echo $(hostname) has $mem bytes memory.+- $(( $mem /1024 )) mb

Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
federico_3
Honored Contributor

Re: physical memory

I'd do like the following:

for 10.20
REAL_MEM=`echo "physmem/D"| adb -k /stand/vmunix /dev/kmem | tail -1 | awk '{ print $2/256} '`
for 11.00
REAL_MEM=`echo "phys_mem_pages/D"| adb -k /stand/vmunix /dev/kmem | tail -1 | awk '{ print $2/256} '`

The value upon are in MBs

Ciao
Federico

Joseph A Benaiah_1
Regular Advisor

Re: physical memory

All methods described above work well. Here are 2 others:

1. wc -c /dev/mem gives physical memory in bytes.

2. Example code using pstat

/* pysmem.c */
#include

main()
{
struct pst_pstatic buf;
pstat_getstatic(&buf, sizeof(buf), 0, 0);
printf("Physical RAM = %ld MB\n", buf.physical_memory/256);
}

Compile this by running

cc physmem.c -o physmem

Cheers,

Joseph.
SysAdm Milano
Occasional Advisor

Re: physical memory

error pst_static and no pst_pstatic
Geoff Wild
Honored Contributor

Re: physical memory

Here's one more - a script called hpmem - uses adb...

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.