#!/bin/sh # dnlc: print directory/inode cache # # Your directory/inode cache should # have a hit rate of at least 93-95%. # Sample output after around 11 days of uptime: # # me% ./dnlc # Directory/inode cache statistics # (See /usr/include/sys/dnlc.h for more information) # # maxphys: 3145728 Max physical request # ufs_ninode: 896000 Inode cache size # sq_max_size: 800 Streams queue # ncsize: 896000 Directory name cache size # ncstats: 1042252708 # of cache hits that we used # ncstats+4: 16276718 # of misses # ncstats+8: 16602182 # of enters done # ncstats+0xc: 47274 # of enters tried when already cached # ncstats+0x10: 0 # of long names tried to enter # ncstats+0x14: 0 # of long name tried to look up # ncstats+0x18: 22957937 # of times LRU list was empty # ncstats+0x1c: 227 # of purges of cache # 98 Hit rate percentage PATH=/bin:/usr/bin export PATH cmd=' BEGIN { fmt = "%-13s %9d %s\n" } /:.../ { s = substr ($0, 30); printf fmt, $1, $2, s } /perc/ { s = substr ($0, 30); printf fmt, " ", $1, s } ' echo 'Directory/inode cache statistics' echo '(See /usr/include/sys/dnlc.h for more information)' echo adb -k /dev/ksyms /dev/mem <a *(ncstats+4)%1000>b *(ncstats+14)%1000>c n