]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - cddl/contrib/dtracetoolkit/Disk/iofileb.d
Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.
[FreeBSD/stable/10.git] / cddl / contrib / dtracetoolkit / Disk / iofileb.d
1 #!/usr/sbin/dtrace -s
2 /*
3  * iofileb.d - I/O bytes by filename and process.
4  *             Written using DTrace (Solaris 10 3/05).
5  *
6  * This prints a summary of requested disk activity by pathname,
7  * providing totals of the I/O events in bytes. It is a companion to the
8  * iofile.d script - which prints in terms of I/O wait time, not bytes.
9  * I/O wait time is a better metric for understanding performance issues.
10  * Both disk and NFS I/O are measured.
11  *
12  * $Id: iofileb.d 3 2007-08-01 10:50:08Z brendan $
13  *
14  * USAGE:       iofileb.d       # wait several seconds, then hit Ctrl-C
15  *
16  * FIELDS:
17  *              PID     process ID
18  *              CMD     command name
19  *              KB      Kilobytes of disk I/O
20  *              FILE    Full pathname of the file
21  *
22  * COPYRIGHT: Copyright (c) 2006 Brendan Gregg.
23  *
24  * CDDL HEADER START
25  *
26  *  The contents of this file are subject to the terms of the
27  *  Common Development and Distribution License, Version 1.0 only
28  *  (the "License").  You may not use this file except in compliance
29  *  with the License.
30  *
31  *  You can obtain a copy of the license at Docs/cddl1.txt
32  *  or http://www.opensolaris.org/os/licensing.
33  *  See the License for the specific language governing permissions
34  *  and limitations under the License.
35  *
36  * CDDL HEADER END
37  *
38  * 20-Feb-2006  Brendan Gregg   Created this.
39  * 20-Feb-2006     "      "     Last update.
40  */
41
42 #pragma D option quiet
43
44 dtrace:::BEGIN
45 {
46         printf("Tracing... Hit Ctrl-C to end.\n");
47 }
48
49 io:::start
50 {
51         @files[pid, execname, args[2]->fi_pathname] = sum(args[0]->b_bcount);
52 }
53
54 dtrace:::END
55 {
56         normalize(@files, 1024);
57         printf("%6s %-12s %6s %s\n", "PID", "CMD", "KB", "FILE");
58         printa("%6d %-12.12s %@6d %s\n", @files);
59 }