Converts the macros to function calls to an actual probe. Some probes are excluded to avoid recursing into dtrace.
Sample use:
dtrace -n 'sdt:profile:predict: { @[stringof(args[2]), arg3, arg0 == arg1] = count(); }' -o out
cat out | awk 'NF { all[$1 ":" $2] += $4; if ($3) { hit[$1 ":" $2] = $4; if (miss[$1 ":" $2] == 0) miss[$1 ":" $2] = 0; } else { miss[$1 ":" $2] = $4; if (hit[$1 ":" $2] == 0) hit[$1 ":" $2] = $4; } } END { for (l in all) print l " " all[l] " " hit[l] " " miss[l] " " hit[l] * 100 / (all[l]) }' | sort -rnk 5 | less
Sample from buildkernel in a vm (location, calls, hit, miss, hit %)
/usr/src/sys/kern/vfs_subr.c:3108 131666 123745 7921 93.984
/usr/src/sys/kern/subr_lock.c:138 82423 76362 6061 92.6465
/usr/src/sys/vm/uma_core.c:3196 1048777 962903 85874 91.812
/usr/src/sys/amd64/amd64/trap.c:1083 560031 506280 53751 90.4021
/usr/src/sys/amd64/amd64/vm_machdep.c:516 560039 506280 53759 90.4008
/usr/src/sys/kern/vfs_cache.c:4545 683646 616969 66677 90.2469
/usr/src/sys/kern/vfs_cache.c:2230 11000 9890 1110 89.9091
/usr/src/sys/kern/vfs_subr.c:3530 19645 17632 2013 89.7531
/usr/src/sys/kern/vfs_cache.c:1895 84648 73648 11000 87.005
/usr/src/sys/amd64/amd64/pmap.c:5025 56153 48641 7512 86.6223
/usr/src/sys/kern/uipc_syscalls.c:167 5 4 1 80
/usr/src/sys/kern/kern_lock.c:1275 399022 319204 79818 79.9966
/usr/src/sys/kern/kern_mutex.c:541 5773 4249 1524 73.6012
/usr/src/sys/vm/uma_core.c:3217 7745 5115 2630 66.0426
/usr/src/sys/kern/vfs_cache.c:1930 50 33 17 66
/usr/src/sys/kern/vfs_cache.c:4592 109803 67451 42352 61.4291
/usr/src/sys/kern/uipc_usrreq.c:385 1164 684 480 58.7629
/usr/src/sys/kern/subr_lock.c:131 82423 47944 34479 58.1682
/usr/src/sys/kern/kern_mutex.c:1030 2042 192 1850 9.40255
/usr/src/sys/kern/subr_epoch.c:794 128 8 120 6.25