Operating System - HP-UX
1833762 Members
2188 Online
110063 Solutions
New Discussion

FAQ? How much memory in my system?

 
SOLVED
Go to solution
Trever Furnish
Regular Advisor

FAQ? How much memory in my system?

Ok, I feel quite foolish having to ask what ought to be a simple question, but under HP-UX, how does one tell how much memory is installed? (Oh, and I need to obtain it in a shell or perl script, not just fr
om the command-line.)

There's just GOT to be an easy way...

Before you reply, let me rule out a few anticipated answers...

1. Just do "grep Physical /var/adm/syslog/syslog.log"...

That's assuming the syslog.log file is the same one that was written to during boot-up - it's frequently NOT, and the logs from boot-up are frequently so old as to not be available.

2. Use top or glanceplus.

Ever tried to grep the output of 'top -d 1' on HP-UX? When I do it, all I get is a ton of curses crap.

3. Use cstm.

Ok, well yeah, I can give ya this one, but cstm is awfully slow for my needs, and it prints a lot of other output. I want to lump the collection of this information in with a bunch of others and they all
need to complete in less than five seconds total - cstm takes longer than that just to start on most of our systems.

4. Use adb...

Love to. But can anyone tell me how? On all three platforms (pa-risc hpux 11.11, 11.00, 10.20)?

5. Use print_manifest...

Way too slow.
Hockey PUX?
10 REPLIES 10
Michael Schulte zur Sur
Honored Contributor

Re: FAQ? How much memory in my system?

Hi,

here is a little programme to get memory installed.
http://phaseit.net/claird/comp.unix.admin/admin.html

greetings,

Michael
Robert-Jan Goossens
Honored Contributor

Re: FAQ? How much memory in my system?

# echo 'memory_installed_in_machine/D' | adb -k /stand/vmunix /dev/mem | perl -nle'/(\d+)/&&print$1*4,"k"'

Regards,
Robert-Jan
Sanjay_6
Honored Contributor

Re: FAQ? How much memory in my system?

Hi Trever,

Try this link from itrc,

http://www2.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000063235803

The itrc doc id is KBRC00001146.

The page size for 11.0/11i would be 4K

Hope this helps.

Regds
Fadia Almarei
Super Advisor

Re: FAQ? How much memory in my system?

Hi trever
you can use the following command
#dmesg | grep Physical

and you can use the sam also
Performance Monitors => System Properties

and from it you can see the memory
fadia.marei
D Block 2
Respected Contributor

Re: FAQ? How much memory in my system?

don't feel bad, .. this question remains and concerns us all..

type:
# dmesg

look at the "physical", look at the "allocate" or Reserved..

you might wan to load "glance" (if you don't have, you can activiate or download a 30 day license.) strongly suggest this to understand the limits.

the ITRC.HP.com has lot's of explains and suggestion on this one: build your search and find other docs on: memory .. dbc min.. dbc max..
Golf is a Good Walk Spoiled, Mark Twain.
Hoang Chi Cong_1
Honored Contributor

Re: FAQ? How much memory in my system?

Hi Trever Furnish

Yes, you can use glanceplus to view the physical memory.
With GlancePlus, You not only can see the size of physical memory but also you can see the other information : Total VM, User Mem, Active VM, Buffer cache, Free Mem and etc...

For more complex, you can use stm or xstm command, these are Support Tools Manager which support by HP-UX. You even can check how many memory slots you have and how size.

Hope this helps and goodluck.

Regard,

Jimkery
Looking for a special chance.......
Pete Randall
Outstanding Contributor
Solution

Re: FAQ? How much memory in my system?

Trever,

In answer to number 4, I use this little adb script which should work for all three of your OS releases:

HPUX=/stand/vmunix
MAJORREV=$(uname -r | cut -f2 -d .)
if [ $MAJORREV -ge "11.0" ]
then
MYSYMBOL="phys_mem_pages"
else
MYSYMBOL="physmem"
fi

MYMEM=$(echo "${MYSYMBOL}/D" \
| adb $HPUX /dev/kmem \
| grep "${MYSYMBOL}: *." \
| awk '{printf "%.0f MB\n",$2/256}')
echo $MYMEM


Pete

Pete
Nguyen Anh Tien
Honored Contributor

Re: FAQ? How much memory in my system?

If you only need to check how much physical memory installed on your system, Just user this command.
#dmesg | grep Physical
This command is good at speed. easy.
tienna
HP is simple
Geoff Wild
Honored Contributor

Re: FAQ? How much memory in my system?

Here's a nice script I use:

# cat /usr/local/bin/hpmem
#!/bin/ksh
#
# Taken from the HP/UniGraphics FAQ
# You must be ROOT to execute this since it uses adb to
# examine the running kernel
#
GetKernelSymbol()
{
echo "$1/D" | \
adb -k $hpux /dev/kmem | \
tr "\012" " " | \
read junk junk2 kval
}
hpux=/hp-ux
rev=$(uname -r | cut -d. -f2)
if ((rev > 9)); then hpux=/stand/vmunix ;fi
/bin/uname -a
GetKernelSymbol "processor_count"
print CPU Count: $kval
GetKernelSymbol "itick_per_tick"
let speed=kval/10000
print CPU Speed: $speed MHz
if ((rev > 10)); then
print CPU HW Support: `getconf HW_CPU_SUPP_BITS`-bit
print Kernel Support: `getconf KERNEL_BITS`-bit
GetKernelSymbol "memory_installed_in_machine"
else
GetKernelSymbol "physmem"
fi
let mb=kval*4/1024 # convert pages to MB
print RAM Size: $mb MB
GetKernelSymbol "bufpages"
let mb=kval*4/1024 # convert pages to MB
print bufpages: $mb MB
GetKernelSymbol "maxuprc"
print maxuprc: $kval
GetKernelSymbol "maxvgs"
print maxvgs: $kval
GetKernelSymbol "maxfiles"
print maxfiles: $kval
GetKernelSymbol "max_thread_proc"
print max_thread_proc: $kval
GetKernelSymbol "nfile"
print nfile: $kval
GetKernelSymbol "nflocks"
print nflock: $kval
GetKernelSymbol "nproc"
print nproc: $kval
GetKernelSymbol "ninode"
print ninode: $kval
GetKernelSymbol "vfd_cw"
print shmmax: $kval
GetKernelSymbol "shmmni"
print shmmni: $kval
GetKernelSymbol "dbc_max_pct"
print dbc_max_pct: $kval


Output like:

# hpmem
HP-UX svr003 B.11.11 U 9000/800 2504392627 unlimited-user license
CPU Count: 6
CPU Speed: 750 MHz
CPU HW Support: 64-bit
Kernel Support: 64-bit
RAM Size: 10080 MB
bufpages: 806 MB
maxuprc: 800
maxvgs: 128
maxfiles: 2048
max_thread_proc: 256
nfile: 189100
nflock: 1200
nproc: 2560
ninode: 16384
shmmax: 1073741824
shmmni: 256
dbc_max_pct: 8


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.
Trever Furnish
Regular Advisor

Re: FAQ? How much memory in my system?

I want to thank you all for the solutions.

Robert-Jan, yours almost worked 100%, but the perl doesn't produce the correct results on every system (probably version differences, I didn't look too closely because there were other posts that seem to work). Thank you very much for the response though. Nine points.

To the folks who responded with either glanceplus or dmesg or sam, thanks for the responses, but I specificly said those weren't useful for various reasons, so one point only.
Hockey PUX?