metreg.h --
access to kernel metrics information (kernel system information)
Synopsis
#include <metreg.h>
cc [options] file .... -lmas
Description
Access to kernel information is through the libmas interface (see
Intro(3mas))
using the filesystem path /var/adm/metreg.data
(MAS_FILE in /usr/include/metreg.h).
The actual kernel structures are described in
/usr/include/sys/metrics.h.
This interface replaces direct programmatic access to kernel variables such
as sysinfo, total, mproc via nlist for
obtaining instrumentation or metric information on a running kernel.
Kernel Metrics
Native units:
Macro
Description
HZ_TIX
clock ticks/second
PGSZ
bytes per page
System constants:
Macro
Description
NCPU
number of cpus
NDISK
number of disks
Wait I/O indicators:
Macro
Description
FSWIO
count of outstanding filesystem I/O jobs
PHYSWIO
count of outstanding raw I/O jobs
These global values are synthesized in the kernel from per-cg (UnixWare 7)
or per-cpu (post-UnixWare 7) statistics by a call from the clock handler.
Global scheduling statistics:
Macro
Description
RUNQUE
cumulative global run queue count
RUNOCC
cumulative global run queue occupied
SWPQUE
cumulative count of processes swapped
SWPOCC
count of ticks when processes were swapped
Global process table statistics:
Macro
Description
PROCMAX
upper limit of proc table entries
PROCUSE
count of proc table entries in use
PROCFAIL
failure count
Global light weight processes statistics:
Macro
Description
MPR_LWP_FAIL
failure count
MPR_LWP_USE
count of LWPs in use
MPR_LWP_MAX
unused
NOTE:
These are per-processor LWP statistics and are meaningless
until you sum them.
Global kmemsizes:
Macro
Description
KMPOOLS
number of kma pools
KMASIZE
buffer sizes for pools
Global memory statistics:
Macro
Description
FREEMEM
freemem in pages
FREESWAP
free swap space
Kept as a running dl_t (old long long) sum updated every second
Per processor cpu times:
Macro
Description
MPC_CPU_IDLE
idle time
MPC_CPU_WIO
wait for i/o time
MPC_CPU_USR
user time
MPC_CPU_SYS
system time
MPC_CPU_INTR
interrupt time
Per processor scheduling data:
Macro
Description
MPS_PSWITCH
process switches
MPS_RUNQUE
cumulative engine run queue count
MPS_RUNOCC
cumulative engine run queue occupied
Per processor buffer cache counters:
Macro
Description
MPB_BREAD
reads from disk to buffer cache
MPB_BWRITE
writes from buffer cache to disk
MPB_LREAD
buffer reads requested
MPB_LWRITE
buffer writes requested
MPB_PHREAD
physical reads
MPB_PHWRITE
physical writes
Per processor system calls:
Macro
Description
MPS_SYSCALL
total number of system calls made
MPS_FORK
fork system calls made (all types)
MPS_LWPCREATE
lwpcreate system calls made
MPS_EXEC
exec system calls made
MPS_READ
read system calls made
MPS_WRITE
write system calls made
MPS_READCH
characters read via the read syscall
MPS_WRITECH
characters written via the write syscall
Per processor file lookup statistics:
Macro
Description
MPF_LOOKUP
lookups done
MPF_DNLS_HITS
count of directory names found in cache
MPF_DNLS_MISSES
count of directory names not found in cache
Per processor file table statistics:
The file table is dynamically allocated so there are no maximum
and upper limit values.
Macro
Description
FILETBLINUSE
count of file table entries in use
FILETBLFAIL
failure count
Per processor file locking statistics:
Macro
Description
FLCKTBLMAX
upper limit of file lock table entries
FLCKTBLTOTAL
count of file lock table entries
FLCKTBLINUSE
count of file lock table entries in use
FLCKTBLFAIL
failure count
Per processor file access counts:
Macro
Description
MPF_IGET
count of calls to get inodes
MPF_DIRBLK
count of directory blks read
MPF_IPAGE
count of inodes recycled that had pages
MPF_INOPAGE
count of inodes recycled without pages
Per processor tty statistics:
Macro
Description
MPT_RCVINT
interrupts for data ready to be received
MPT_XMTINT
interrupts for data ready to be transmitted
MPT_MDMINT
modem interrupts
MPT_RAWCH
raw characters received from terminal device
MPT_CANCH
canonical characters recived from terminal device
MPT_OUTCH
characters output to a terminal device
Per processor ipc statistics:
Macro
Description
MPI_MSG
IPC messages sent and received
MPI_SEMA
IPC semaphores operation calls
Per processor vm statistics:
Macro
Description
MPV_PREATCH
pre-mapped pages at time of object/device mapping
MPV_ATCH
page requests fulfilled by a page in memory
MPV_ATCHFREE
page requests fulfilled by a page on freelist
MPV_ATCHFREE_PGOUT
page requests fulfilled by a page on the freelist being paged out
MPV_ATCHMISS
page requests not fulfilled by a page in memory
MPV_PGIN
page-in operations done
MPV_PGPGIN
pages paged-in from secondary storage
MPV_PGOUT
page-out operations done
MPV_PGPGOUT
pages written to secondary storage due to pageouts
MPV_SWPOUT
count of process swap outs completed
MPV_PSWPOUT
pages written to secondary storage due to a swap out
MPV_VPSWPOUT
virtual pages written to secondary storage due to a swap out
MPV_SWPIN
count of process swap ins completed
MPV_PSWPIN
pages brought in from secondary storage due to a swap in (usually just u-area)
MPV_VIRSCAN
count of virtual pages scanned or checked to see if they are eligible for being freed
MPV_VIRFREE
count of virtual pages freed or marked available by a daemon or page aging policy
MPV_PHYSFREE
count of physical pages freed or marked available by a daemon or page aging policy
MPV_PFAULT
protection faults caused by copy on write, or illegal access
MPV_VFAULT
validity faults caused by lack of an address translation
MPV_SFTLOCK
software locks
Per processor kmem statistics:
Macro
Description
MPK_MEM
memory owned by this class
MPK_BALLOC
memory allocated
MPK_RALLOC
memory successfully requested
MPK_FAIL
count of failed requests
Global filesystem types information:
Macro
Description
NFSTYP
count of filesystem types
FSNAMES
names of filesystem types
Per filesystem inode information:
Macro
Description
MAXINODE
upper limit of inodes
CURRINIDE
number of inodes allocated
INUSEINODE
count of inodes currently being used
FAILINODE
failure count
Per filesystem information:
Macro
Description
FSGETPG
count of calls to <fs>_getpage()
FSPGIN
page in operations (calls to fs_getpageio())
FSPGPGIN
pages paged in
FSSECTPGIN
512 byte sectors paged in
FSRDA
read aheads initiated from fs_getpage()
FSRDAPGIN
pages paged in for read ahead - B_ASYNC
FSRDASECTIN
sectors paged in for read ahead - B_ASYNC
FSPUTPG
calls to fs_putpage()
FSPGOUT
page out operations (calls to fs_putpageio())
FSPGPGOUT
pages paged out
FSSECTOUT
sectors paged out
Per disk statistics:
Macro
Description
DS_NAME
name for this drive
DS_CYLS
number of cylinders in this drive
DS_QLEN
Current queue length (# of outstanding jobs)
DS_LASTTIME
last time active & response calculated
DS_RESP
cumulative response time in usecs
DS_ACTIVE
cumulative active time in usecs
DS_READ
count of reads
DS_WRITE
count of writes
DS_MISC
count of miscellaneous operations
DS_READBLK
512 byte blocks read
DS_WRITEBLK
512 byte blocks written
DS_MISCBLK
512 byte blocks used for miscellaneous operations
The disk statistics track queue length as a function of time.
sar uses these values as follows:
Calculate the before and after differences for response and active times.
Average service time: active_diff/(total disk operations)
Percent disk busy: active_diff/elapsed
Average queue length: response_diff/active_diff
Average disk wait: (response_diff-active_diff)/(total disk operations)
The intent of Average disk wait is to identify time that jobs
spend waiting in the queue, not being serviced.
At first, this might seem confusing
because response_diff has units of job-seconds while
active_diff has units of seconds.
The missing information is
an assumption that there is 1 active job being serviced during each
interval where the queue length is non-zero,
which gives active_diff units of job-seconds.
Hence response_diff - active_diff gives the number of
waiting jobs multiplied by the time they were waiting.
STREAMS statistics:
Macro
Description
STR_STREAM_INUSE
streams in use now (not free)
STR_STREAM_TOTAL
streams used since boot
STR_QUEUE_INUSE
queues in use now
STR_QUEUE_TOTAL
queues used since boot
STR_MDBBLK_INUSE
message data blocks in use now
STR_MDBBLK_TOTAL
message data blocks used since boot
STR_MSGBLK_INUSE
message blocks in use now
STR_MSGBLK_TOTAL
message blocks used since boot
STR_LINK_INUSE
link blocks in use now
STR_LINK_TOTAL
link blocks used since boot
STR_EVENT_INUSE
strevent in use now
STR_EVENT_TOTAL
strevent used since boot
STR_EVENT_FAIL
strevent - number of failed attempts
ccNUMA:
Macro
Description
NCG
number of cpu groups
MPG_CGID
cpu group ids
vmeter:
See /usr/include/sys/vmmeter.h.
Many of these may be unused/unset by the kernel at this time.
V_SWTCH
V_TRAP
V_SYSCALL
V_INTR
V_PDMA
V_PSWPIN
V_PSWPOUT
V_PGIN
V_PGOUT
V_PGPGIN
V_PGPGOUT
V_INTRANS
V_PGREC
V_XSFREC
V_XIFREC
V_ZFOD
V_PGFREC
V_FAULTS
V_SCAN
V_REV
V_DFREE
V_FASTPGREC
V_SWPIN
V_SWPOUT
Mapping of macros from metreg.h, units, types and sizes:
(for use with verification routine, see use in example below).