Operating System - HP-UX
1834758 Members
3146 Online
110070 Solutions
New Discussion

Re: How to monitoring sysmap structure

 
양건호
New Member

How to monitoring sysmap structure

I have a test machine rp5470 which is run on HP-UX 11.0
When I check proc structure, I used Q4.
Q4> load struct proc from proc max nproc

I want to check structure sysmap.
q4> fields -c struct sysmap
can't find "struct sysmap" in the catalog
How can I get the information of kernel memory?
2 REPLIES 2
Stefan Farrelly
Honored Contributor

Re: How to monitoring sysmap structure

Heres a script that used to work on 10.20 or 11.0(32bit). You can see how it works and you should be able to adapt for 11/64, eg. change adb to adb64 and the sysmap_32bitxxx variables to 64bit.

#!/usr/bin/sh
# a crude tool to monitor sysmap fragmentation
# print warning to stderr if less then WARN percent of
# sysmap entries are free, or no chunk of size MINCHUNK available
# WARN=10 and MINCHUNK=50000 are guesses only, no scientifically
# determined default values
# may be adapted to 9.X (but why?), possibly to read dumps
# or other maps
# NOTE:
# The sysmap table holds entries for free and used virtual memory
# locations. If sysmap becomes full, you cannot allocate any more
# open virtual memory addresses (sysmap ovflo error in dmesg).
# From HP-UX 10.X to 10.20, the number of sysmap entries is determined
# by 2*nproc, if nproc is larger than 800, otherwise the number of
# entries is set to 800.
# From HP-UX 10.30 and later the kernel tunable parameter 'nsysmap'
# allows you to appropriately size the map.

WARN=10
MINCHUNK=50000
ADB=/usr/bin/adb64
#OPT=-k /stand/vmunix /dev/kmem
OPT="/stand/vmunix /dev/kmem"
get_one_value()
{
echo $1|$ADB $(echo $OPT)|tail -1|awk '{print $2}'
}
#typeset -i SYSMAP=$(get_one_value sysmap/D)
#typeset -i SYSMAP_END=$(get_one_value sysmapNSYSMAP/D)
#typeset -i SYSMAP_END1=$(get_one_value 0d$SYSMAP/D)
if [ `uname -r` = "B.11.00" ]
then
SYSMAP=$(get_one_value sysmap_32bit/D)
SYSMAP_END=$(get_one_value sysmap_32bitNSYSMAP/D)
else
SYSMAP=$(get_one_value sysmap/D)
SYSMAP_END=$(get_one_value sysmapNSYSMAP/D)
fi
SYSMAP_END1=$(get_one_value 0d$SYSMAP/D)
#echo "*$SYSMAP* *$SYSMAP_END* *$SYSMAP_END1*"
if [ $SYSMAP_END -ne $SYSMAP_END1 ]; then
echo $0: Unable to determine size of sysmap - exiting
exit 1
fi
(( MAPSIZE = ( SYSMAP_END - SYSMAP ) / 8 ))
(( MAPLINES = MAPSIZE - 2 ))
(( SYSMAP = SYSMAP + 8 ))
FREE=0
(echo "0d$SYSMAP/2D"; yes "" | head -n $MAPLINES)\
| $ADB $(echo $OPT) |
awk ' { if ( ($2 == 0) ($3 == 0) )
{ FREE = FREE + 1 }
else { FREE = 0 }
if ( $2 > MAX ) { MAX = $2; }
}
END{ print FREE, MAX } ' |
read FREE MAX
echo $FREE of $MAPSIZE entries in sysmap are free
echo maximum available chunk size is $MAX
PCT=0
(( PCT = ( 100 * FREE ) / MAPSIZE ))
if [ $PCT -lt $WARN -o $MAX -lt $MINCHUNK ]; then
if [ $PCT -lt $WARN ] ; then
echo $0: Warning: less than $WARN percent of sysmap are free >&2
fi
if [ $MAX -lt $MINCHUNK ]; then
echo $0: Warning: no chunk of size $MINCHUNK in sysmap >&2
fi
exit 1
else
exit 0
fi
Im from Palmerston North, New Zealand, but somehow ended up in London...
Dietmar Konermann
Honored Contributor

Re: How to monitoring sysmap structure

You should have a look at the kmeminfo tool that comes with Q4, e.g. PHCO_28601 for 11.00). It's located in /usr/contrib/Q4/bin.

Try:
# kmeminfo -sysmap

or for older revisions:
# kmeminfo -o sysmap


Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)