nfsv3fileio.d Reports Read and Writes
This DTrace script prints a summary of file read and write bytes:
#!/usr/sbin/dtrace -s
#pragma D option quiet
dtrace:::BEGIN
{
trace("Tracing... Hit Ctrl-C to end.\n");
}
nfsv3:::op-read-done
{
@readbytes[args[1]->noi_curpath] = sum(args[2]->res_u.ok.data.data_len);
}
nfsv3:::op-write-done
{
@writebytes[args[1]->noi_curpath] = sum(args[2]->res_u.ok.count);
}
dtrace:::END
{
printf("\n%12s %12s %s\n", "Rbytes", "Wbytes", "Pathname");
printa("%@12d %@12d %s\n", @readbytes, @writebytes);
}This output shows a few files were read, and one was written:
# ./nfsv3fileio.d
Tracing... Hit Ctrl-C to end.
^C
Rbytes Wbytes Pathname
0 206663 /export/stuff/words10
8624 0 /export/stuff/bin/echo-client-2
13228 0 /export/stuff/bin/echo
496292 0 /export/stuff/bin/ecpgThe following table describes the fields that are printed by the nfsv3fileio.d script.
| Field | Description |
|---|---|
|
|
Bytes read for this path name |
|
|
Bytes written to this path name |
|
|
Path name of NFS file |