Operating System - HP-UX
1833015 Members
2114 Online
110048 Solutions
New Discussion

Collecting info from kernel by echo

 
SOLVED
Go to solution
Ranjit_3
Advisor

Collecting info from kernel by echo

Hi All ,
Below are some commands to collect stats related to CPU by echo and it collects from kernel .
Is there any link or good doc where i can get all the parameters and arguments which can be used with this echo command to get various other details .

1) echo itick_per_usec/D | adb -k /stand/vmunix /dev/mem
2) echo runningprocs/D | adb -k /stand/vmunix /dev/mem

Thanks in advance ..
7 REPLIES 7
Florian Heigl (new acc)
Honored Contributor

Re: Collecting info from kernel by echo

You might most definitely want to look into the book 'HP-UX 11.11 internals' - most of the header files relevant to what You seek should be mentioned in there.

I also tried a few other things ago, but I don't remember much of that any more :>
yesterday I stood at the edge. Today I'm one step ahead.
A. Clay Stephenson
Acclaimed Contributor

Re: Collecting info from kernel by echo

It's not really the echo command but rather the adb command that's doing the work. Man adb for details. You can also do a "nm /stand/vmunix" to get a listing of interestin g symbols.
If it ain't broke, I can fix that.
Uday_S_Ankolekar
Honored Contributor
Solution

Re: Collecting info from kernel by echo

Look in knowledge base for various adb command with echo..
Here are some

echo physmem/D | adb /stand/vmunix /dev/kmem

physmem:
physmem: 24576

for 32 bit HP-UX 11.x systems :

example:

echo phys_mem_pages/D | adb /stand/vmunix /dev/kmem

phys_mem_pages:
phys_mem_pages: 24576

for 64 bit systems :

example:

echo phys_mem_pages/D | adb64 /stand/vmunix /dev/mem

phys_mem_pages:
phys_mem_pages: 262144


To determine the amount of lockable memory for 32 bit systems :

example:

echo total_lockable_mem/D | adb /stand/vmunix /dev/mem

total_lockable_mem:
total_lockable_mem: 185280

for 64 bit systems :

echo total_lockable_mem/D |adb64 /stand/vmunix /dev/mem

total_lockable_mem:
total_lockable_mem: 283750

Total lockable memory is expressed in Kilobytes

To determine the number of free swap 4096 byte memory pages :
example:

echo swapspc_cnt/D | adb /stand/vmunix /dev/kmem

swapspc_cnt:
swapspc_cnt: 216447



To determine the CPU speed:

example:

echo itick_per_usec/D | adb /stand/vmunix /dev/mem

itick_per_usec:
itick_per_usec: 360

To determine the number of processors in use:

example:

echo "runningprocs/D" | adb /stand/vmunix /dev/mem

runningprocs:
runningprocs: 2

To determine the number of 4096 byte memory pages of buffer cache

example:

echo bufpages/D | adb /stand/vmunix /dev/mem
bufpages:
bufpages: 18848

To display kernel parameters using adb use the parameter name :

example:

echo nproc/D | adb /stand/vmunix /dev/mem

nproc:
nproc: 276


To determine the kernel you are booted from:

example:


echo 'boot_string/S' | adb /stand/vmunix /dev/mem
boot_string:
boot_string: disc(52.6.0;0)/stand/vmunix

-USA..
Good Luck..
RAC_1
Honored Contributor

Re: Collecting info from kernel by echo

You can also do strings /stand/vmunix
There is no substitute to HARDWORK
Geoff Wild
Honored Contributor

Re: Collecting info from kernel by echo

You can also script it like this:

# 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


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.
Ranjit_3
Advisor

Re: Collecting info from kernel by echo

Thanks a lot to you all for your time and nice replies .I got the information what i was looking for from your replies .

I have submitted the points ..

Thanks ..
Ranjit_3
Advisor

Re: Collecting info from kernel by echo

.