3 * rfsio.d - read FS I/O stats, with cache miss rate.
4 * Written using DTrace (Solaris 10 3/05)
6 * This script provides statistics on the number of reads and the bytes
7 * read from filesystems (logical), and the number of bytes read from
8 * disk (physical). A summary is printed every five seconds by filesystem.
10 * A total miss-rate is also provided for the file system cache.
12 * $Id: rfsio.d 3 2007-08-01 10:50:08Z brendan $
16 * IDEA: Richard McDougall, Solaris Internals 2nd Ed, FS Chapter.
18 * COPYRIGHT: Copyright (c) 2006 Brendan Gregg.
22 * The contents of this file are subject to the terms of the
23 * Common Development and Distribution License, Version 1.0 only
24 * (the "License"). You may not use this file except in compliance
27 * You can obtain a copy of the license at Docs/cddl1.txt
28 * or http://www.opensolaris.org/os/licensing.
29 * See the License for the specific language governing permissions
30 * and limitations under the License.
34 * 19-Mar-2006 Brendan Gregg Created this.
35 * 23-Apr-2006 " " Last update.
38 #pragma D option quiet
46 trace("Tracing...\n");
52 self->fs_mount = args[0]->v_vfsp == `rootvfs ? "/" :
53 args[0]->v_vfsp->vfs_vnodecovered ?
54 stringof(args[0]->v_vfsp->vfs_vnodecovered->v_path) : NULL;
58 /self->fs_mount != NULL/
60 @rio[self->fs_mount, "logical"] = count();
61 lbytes += args[1]->uio_resid;
62 self->size = args[1]->uio_resid;
69 @rbytes[self->fs_mount, "logical"] =
70 sum(self->size - self->uiop->uio_resid);
76 io::bdev_strategy:start
77 /self->size && args[0]->b_flags & B_READ/
79 @rio[self->fs_mount, "physical"] = count();
80 @rbytes[self->fs_mount, "physical"] = sum(args[0]->b_bcount);
81 pbytes += args[0]->b_bcount;
88 printf("\033[H\033[2J");
89 printf("\nRead IOPS (count)\n");
90 printa("%-32s %10s %10@d\n", @rio);
91 printf("\nRead Bandwidth (bytes)\n");
92 printa("%-32s %10s %10@d\n", @rbytes);
93 printf("\nTotal File System miss-rate: %d%%\n",
94 lbytes ? 100 * pbytes / lbytes : 0);