ocstat

Nicolas Thery nthery at gmail.com
Tue Jun 3 22:00:20 PDT 2008


Hello,

As part of my quest of migrating zones allocations to kmalloc/objcache,
I'm writing a small utility that dumps stats about each object cache.

By default, it displays (from left to right), the cache name, magazine capacity
(MAGC), number of unallocated objects (UNOBJ), number of empty (EMAG)
and full magazines (FMAG) in the depot, number of objects in loaded (LRD)
and previous (PRD) rounds.  Per-cpu values are separated by commas:

$ ocstat
 NAME            MAGC UNOBJ EMAG FMAG LRD      PRD
vnodes          256 -1120  2    0    0,0      0,0
nameibufs       64  -5     2    0    2,2      0,0
cdev_t          32  -351   2    0    0,0      0,0
vmspace         32  -24    2    0    16,0     0,0
thread          3   -23    2    0    0,1      3,0
exec-args       2   30     6    0    1,1      0,0
CCMS            64  -1120  2    0    0,0      0,0
mbuf pkt hdr + cluster     64   1024 6   0   0,0      0,0
mbuf + cluster  64  1024   6    0    0,0      0,0
cluster mbuf    64  1024   6    0    0,0      0,0
mbuf pkt hdr    64  2044   10   0    4,0      0,0
mbuf            64  2042   10   0    5,0      0,0

It also provides the number of successful gets and puts and failed
gets since boot:

$ocstat -c
NAME            GET       PUT      NUL
vnodes          972,147   0,0      0,0
nameibufs       3806,1237 3806,1237 0,0
cdev_t          350,0     0,0      0,0
vmspace         235,438   247,419  0,0
thread          245,440   247,420  0,0
exec-args       358,114   358,114  0,0
CCMS            972,147   0,0      0,0
mbuf pkt hdr + cluster    0,0      0,0      0,0
mbuf + cluster  0,0       0,0      0,0
cluster mbuf    0,0       0,0      0,0
mbuf pkt hdr    2,3       5,0      0,0
mbuf            4,3       6,0      0,0

There is also a -l option to display all available stats and a -o one
to select what
fields to display (a la ps(1)).

Internally, I added an opaque sysctl to objcache that dumps all stats and is
parsed by ocstat.

Do you think this could be added to base?  If so, I'll clean up the code
and email patches here.

Cheers,
Nicolas





More information about the Kernel mailing list