Operating System - HP-UX
1833150 Members
3434 Online
110051 Solutions
New Discussion

Re: Problem determining how much RAM my system has.

 
SOLVED
Go to solution
SALVATORI Ludovic
Occasional Contributor

Problem determining how much RAM my system has.

I'm working on a Superdome VPar running HP-
Ux 11.11.

I'd like to determine how much RAM my system has

Which device may I use : /dev/mem or /dev/kmem :

echo "phys_mem_pages/D" | adb -k /stand/vmunix /dev/kmem | tail -1 | awk '{print $2}'

I have 4 VPar running the same OS level but on 2, the command with /dev/mem doesn't work.
Lps
9 REPLIES 9
Pete Randall
Outstanding Contributor

Re: Problem determining how much RAM my system has.

I'm not sure with VPARs involved. This is what I normally use:

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
Alzhy
Honored Contributor

Re: Problem determining how much RAM my system has.

If you'd like to know how much RAM you have for your vPar, you can use "vparstatus" --- which should show you all the other vPars as well and their allocated memory. You can also use "print_manifest" to check your current vPar's memory as well as other system info.

To get the entire SuprDome's memory -- you can invoke "parstatus -v".
Hakuna Matata.
Stefan Farrelly
Honored Contributor

Re: Problem determining how much RAM my system has.

We use this;

#!/bin/sh
if [ $(uname -r) = "B.11.11" -o $(uname -r) = "B.11.00" ]
then
echo "phys_mem_pages/D" | adb /stand/vmunix /dev/kmem|grep phys|tail -1|awk '{printf "%.0f Mb\n",$2/256}'
elif [ $(uname -r) = "B.10.20" ]
then
echo "physmem/D" | adb /stand/vmunix /dev/kmem|grep phys|tail -1|awk '{print "Memory size = " $2 / 256 " Megabytes"}'
fi

Im from Palmerston North, New Zealand, but somehow ended up in London...
Alzhy
Honored Contributor

Re: Problem determining how much RAM my system has.

Here's a sample "vparstatus" on a rp8400 system with one nPar and 4 vPars on this nPar:

root@fht002a3 # vparstatus -w
The current virtual partition is fht002a3.

root@fht002a3 # vparstatus
[Virtual Partition]
Boot
Virtual Partition Name State Attributes Kernel Path Opts
============================== ===== ========== ========================= =====
fhd002a0 Up Dyn,Auto /stand/vmunix
fht002a1 Up Dyn,Auto /stand/vmunix
fht002a2 Up Dyn,Auto /stand/vmunix
fht002a3 Up Dyn,Auto /stand/vmunix

[Virtual Partition Resource Summary]
CPU Num Memory (MB)
CPU Bound/ IO # Ranges/
Virtual Partition Name Min/Max Unbound devs Total MB Total MB
============================== ================ ==== ====================
fhd002a0 4/ 8 4 4 15 0/ 0 16384
fht002a1 4/ 8 4 0 8 0/ 0 8192
fht002a2 2/ 4 2 0 8 0/ 0 4096
fht002a3 2/ 4 2 0 8 0/ 0 4096
root@fht002a3 #

Of course, print_manifest also would show you the amount of memory on your current vPar and all other sysinfo you'll need.
Hakuna Matata.
SALVATORI Ludovic
Occasional Contributor

Re: Problem determining how much RAM my system has.

So, I've to understand that I have to use /dev/kmem instead of /dev/mem ?!

Thank you for your quick answers !!!

Ps : This command is launched by the script /var/PSS/hpux_config.
Lps
Alzhy
Honored Contributor

Re: Problem determining how much RAM my system has.

Bear in mind that "how much memory my system has" is different than "how much memory my VPAR has".

vparstatus, print_manifest and the scripts suggested WILL show you your VPAR's memory.

parstatus -- will show you your entire complex (SuperDome) memory.

Hakuna Matata.
Todd McDaniel_1
Honored Contributor
Solution

Re: Problem determining how much RAM my system has.

Here is a script I found on the internet that gives you quite a bit of info, including RAM.

--------------------------cut here---------------------------
# cat hpmem
#!/bin/ksh
#
# Taken from the HP/UniGraphics FAQ
# You must be ROOT to execute this since
# 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
/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_SU
print Kernel Support: `getconf KERNEL_BI
GetKernelSymbol "memory_installed_in_mac
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
--------------------------------cut here---------------------------------

OUTPUT is as follows from one of my boxes:

HP-UX chdcfas1 B.11.11 U 9000/800 624339393 unlimited-user license
CPU Count: 8
CPU Speed: 550 MHz
CPU HW Support: 64-bit
Kernel Support: 64-bit
RAM Size: 32768 MB
bufpages: 1310 MB
maxuprc: 4000
maxvgs: 255
maxfiles: 500
max_thread_proc: 256
nfile: 29539
nflock: 4096
nproc: 16020
ninode: 18468
shmmax: 1073741824
shmmni: 220
dbc_max_pct: 4


Unix, the other white meat.
SALVATORI Ludovic
Occasional Contributor

Re: Problem determining how much RAM my system has.

@Nelson : I gave you only 2 points because my question is about the adb command not about vpar... Maybe my first post was ambigous... Forgive the vpar, let's talk only about adb !
Lps
Todd McDaniel_1
Honored Contributor

Re: Problem determining how much RAM my system has.

Salvatori,

No points here, Just FYI.

If you read Nelson's post again, the vparstatus command does give you the memory at the bottom of his first post.

The columns are hard to read, but it is there.
Unix, the other white meat.