Showing results for 
Search instead for 
Did you mean: 


Occasional Contributor


Hi all,

I've found a script to get information about HP-UX as written below.

My question is:
Since the below script uses a method called GetKernelSymbol(), could someone please in this forum give some explanation what it actually does?

Thank you, guys!

# Taken from the HP/UniGraphics FAQ
# You must be ROOT to execute this since it uses adb to
# examine the running kernel
echo "$1/D" | \
sudo adb -k $hpux /dev/kmem | \
tr "\012" " " | \
read junk junk2 kval
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"
GetKernelSymbol "physmem"
let mb=kval*4/1024 # convert pages to MB
print RAM Size: $mb MB
Dennis Handly
Acclaimed Contributor

Re: GetKernelSymbol()

>could someone please in this forum give some explanation what it actually does?

The function should be trivial to understand.
It basically invokes adb to print the value (in decimal) of specific kernel variables.

The result is assigned to kval.
Laurent Menase
Honored Contributor

Re: GetKernelSymbol()

adb is a assembly debugger
echo "physmem/D" | adb -k /stand/vmunix /dev/kmem
display the value in decimal of the kernel symbol "physmem", taken from the kernel memory.

since 11.23 physmem doesn't exist anymore, so we get memory_installed_in_machine

itick_per_tick is the number of cpu cycles per 10ms

it is advised to use pstat_getstatic() in place of that type of tricks.