xref: /freebsd/share/man/man4/dtrace_io.4 (revision e5b786625f7f82a1fa91e41823332459ea5550f9)
1.\" Copyright (c) 2015 Mark Johnston <markj@FreeBSD.org>
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.Dd April 18, 2015
26.Dt DTRACE_IO 4
27.Os
28.Sh NAME
29.Nm dtrace_io
30.Nd a DTrace provider for tracing events related to disk I/O
31.Sh SYNOPSIS
32.Fn io:::start "struct bio *" "struct devstat *"
33.Fn io:::done "struct bio *" "struct devstat *"
34.Sh DESCRIPTION
35The
36.Nm io
37provider allows the tracing of disk I/O events.
38The
39.Fn io:::start
40probe fires when a I/O request is about to be sent to the backing driver of a
41.Xr disk 9
42object.
43This occurs after all
44.Xr GEOM 4
45transformations have been performed on the request.
46The
47.Fn io:::done
48probe fires when a I/O request is completed.
49Both probes take a
50.Vt "struct bio *"
51representing the I/O request as their first argument.
52The second argument is a
53.Vt "struct devstat *"
54for the underlying
55.Xr disk 9
56object.
57.Sh ARGUMENTS
58The fields of
59.Vt "struct bio"
60are described in the
61.Xr g_bio 9
62manual page, and the fields of
63.Vt "struct devstat"
64are described in the
65.Xr devstat 9
66manual page.
67Translators for the
68.Vt bufinfo_t
69and
70.Vt devinfo_t
71D types are defined in
72.Pa /usr/lib/dtrace/io.d .
73.Sh FILES
74.Bl -tag -width "/usr/lib/dtrace/io.d" -compact
75.It Pa /usr/lib/dtrace/io.d
76DTrace type and translator definitions for the
77.Nm io
78provider.
79.El
80.Sh EXAMPLES
81The following script shows a per-process breakdown of total I/O by disk device:
82.Bd -literal -offset indent
83#pragma D option quiet
84
85io:::start
86{
87        @[args[1]->device_name, execname, pid] = sum(args[0]->bio_bcount);
88}
89
90END
91{
92        printf("%10s %20s %10s %15s\\n", "DEVICE", "APP", "PID", "BYTES");
93        printa("%10s %20s %10d %15@d\\n", @);
94}
95.Ed
96.Sh COMPATIBILITY
97This provider is not compatible with the
98.Nm io
99provider found in Solaris, as its probes use native
100.Fx
101argument types.
102.Sh SEE ALSO
103.Xr dtrace 1 ,
104.Xr devstat 9 ,
105.Xr SDT 9
106.Sh HISTORY
107The
108.Nm io
109provider first appeared in
110.Fx
1119.2 and 10.0.
112.Sh AUTHORS
113This manual page was written by
114.An Mark Johnston Aq Mt markj@FreeBSD.org .
115.Sh BUGS
116The
117.Fn io:::wait-start
118and
119.Fn io:::wait-done
120probes are not currently implemented on
121.Fx .
122