nfsv4fileio.d Reports Reads 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");
}
nfsv4:::op-read-done
{
@readbytes[args[1]->noi_curpath] = sum(args[2]->data_len);
}
nfsv4:::op-write-done
{
@writebytes[args[1]->noi_curpath] = sum(args[2]->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:
# ./nfsv4fileio.d
Tracing... Hit Ctrl-C to end.
^C
Rbytes Wbytes Pathname
0 206663 /export/share/words1
24528 0 /export/share/bin/xargs
44864 0 /export/share/bin/ed
232476 0 /export/share/bin/viThe fields printed are:
| Field | Description |
|---|---|
|
|
Bytes read for this path name |
|
|
Bytes written to this path name |
|
|
Path name of NFS file |