Gathering file and directory statistics with DTrace


After learning about fsstat, I decided to create a similar program that used DTrace (fsstat uses libkstat). After reading through syscall.h and reviewing the system calls available in the syscall provider, I created dfsstat.pl:

$ dfsstat.pl 5

process open close read write stat creat link unlink symlink mkdir rmdir
cat 148 148 74 37 111 0 0 0 0 0 0
dfsstat.pl 0 0 6 0 0 0 0 0 0 0 0
dtrace 0 0 0 7 0 0 0 0 0 0 0
ln 111 74 0 0 185 0 0 0 37 0 0
mkdir 148 111 0 0 148 0 0 0 0 37 0
mv 111 74 0 0 111 0 0 0 0 0 0
rm 370 259 0 0 370 0 0 222 0 0 37
test.sh 0 222 0 37 0 74 0 0 0 0 0
touch 111 222 0 0 407 148 0 0 0 0 0

Hope folks find this useful.

This article was posted by Matty on 2006-04-02 19:38:00 -0400 -0400