The docs for the NFS DTrace provider are pretty good on the Oracle website. The scripts in particular that look useful to you are nfsv3fileio.d
or (to get a lot more data that you might have to post-process) nfsv3rwsnoop.d
.
Assuming you mean "most used" as in "highest number of reads / writes", and you don't care about the proportion between those or who is doing them, a simple script to print the filenames and the IO count to each of them is:
nfsv3:::op-read-start, nfsv3:::op-write-start {
@[args[1]->noi_curpath] = count();
}
tick-10sec {
printa(@);
trunc(@);
}
(I didn't run this because I don't have any NFS shares set up, but I think it will work.) To summarize what it's doing:
nfsv3:::op-{read|write}-start
are the events that trigger when a read or a write begins on an NFSv3 share. Each time one of those happens, the event gets an argument args[1]
that contains the variable noi_curpath
, which gives the file's path (if available; occasionally it's not cached so you get nothing). We use that as a key, and use the count()
of times this happens as the value in a map named @
.
tick-10sec
is an event that triggers every 10 seconds, starting 10 seconds after the script begins. It first prints the map with printa()
, and then clears the values in it with trunc()
so we get fresh data for the next 10 second window.