Makefile fixes
[blktrace.git] / doc / blktrace.8
CommitLineData
98eee4e4
JA
1.TH BLKTRACE 8 "March 6, 2007" "blktrace git\-20070306202522" ""
2
3
4.SH NAME
5blktrace \- generate traces of the i/o traffic on block devices
6
7
8.SH SYNOPSIS
9.B blktrace \-d \fIdev\fR [ \-r \fIdebugfs_path\fR ] [ \-o \fIoutput\fR ] [\-k ] [ \-w \fItime\fR ] [ \-a \fIaction\fR ] [ \-A \fIaction_mask\fR ] [ \-v ]
10.br
11
12
13.SH DESCRIPTION
14blktrace is a block layer IO tracing mechanism which provides detailed
15information about request queue operations up to user space. There are three
16major components: a kernel component, a utility to record the i/o trace
17information for the kernel to user space, and utilities to analyse and view the
18trace information. This man page describes blktrace, which records the i/o event
19trace information for a specific block device to a file.
20
21The \fBblktrace\fR utility extracts event traces from the kernel (via
22the relaying through the debug file system). Some background details
23concerning the run\-time behaviour of blktrace will help to understand some
24of the more arcane command line options:
25
26.TP 2
27\-
28blktrace receives data from the kernel in buffers passed up through the
29debug file system (relay). Each device being traced has a file created in
30the mounted directory for the debugfs, which defaults to
31\fI/sys/kernel/debug\fR \-\- this can be overridden with the \fB\-r\fR command
32line argument.
33
34.TP 2
35\-
36blktrace defaults to collecting all events that can be traced. To
37limit the events being captured, you can specify one or more filter masks
38via the \fB\-a\fR option.
39
40Alternatively, one may specify the entire mask utilising a hexadecimal
41value that is version\-specific. (Requires understanding of the internal
42representation of the filter mask.)
43
44.TP 2
45\-
46As noted above, the events are passed up via a series of buffers stored
47into debugfs files. The size and number of buffers can be specified via
48the \fB\-b\fR and \fB\-n\fR arguments respectively.
49
50.TP 2
51\-
52blktrace stores the extracted data into files stored in the
53local directory. The format of the file names is (by default)
54\fBdevice\fR.\fBblktrace\fR.\fBcpu\fR, where \fBdevice\fR is the base
55device name (e.g, if we are tracing /dev/sda, the base device name would
56be \fBsda\fR); and \fBcpu\fR identifies a CPU for the event stream.
57
58The \fBdevice\fR portion of the event file name can be changed via
59the \fB\-o\fR option.
60
61.TP 2
62\-
63blktrace may also be run concurrently with blkparse to produce
64\fBlive\fR output \-\- to do this specify \fB\-o \-\fR for blktrace.
65
66.TP 2
67\-
68The default behaviour for blktrace is to run forever until explicitly
69killed by the user (via a control-C, or kill utility invocation).
70There are two ways to modify this:
71
72.TP 5
73 1.
74You may utilise the blktrace utility itself to kill
75a running trace -- via the \fB\-k\fR option.
76
77.TP 5
78 2.
79You can specify a run-time duration for blktrace via the
80\fB\-w\fR option -- then blktrace will run for the specified number
81of seconds, and then halt.
82
83
84.SH OPTIONS
85
86\-A \fIhex-mask\fR
87.br
88\-\-set-mask=\fIhex-mask\fR
89.RS
90Set filter mask to \fIhex-mask\fR (see below for masks)
91.RE
92
93\-a \fImask\fR
94.br
95\-\-act-mask=\fImask\fR
96.RS
97Add \fImask\fR to current filter (see below for masks)
98.RE
99
100\-b \fIsize\fR
101.br
102\-\-buffer\-size=\fIsize\fR
103.RS
104Specifies buffer size for event extraction (scaled by 1024)
105.RE
106
107\-d \fIdev\fR
108.br
109\-\-dev=\fIdev\fR
110.RS
111Adds \fIdev\fR as a device to trace
112.RE
113
114\-I \fIfile\fR
115.br
116\-\-input-devs=\fIfile\fR
117.RS
118Adds the devices found in \fIfile\fR as devices to trace
119
120\-k
121.br
122\-\-kill
123.RS
124Kill on-going trace
125.RE
126
127\-n \fInum\-sub\fR
128.br
129\-\-num\-sub=\fInum-sub\fR
130.RS
131Specifies number of buffers to use
132.RE
133
134\-o \fIfile\fR
135.br
136\-\-output=\fIfile\fR
137.RS
138Prepend \fIfile\fR to output file name(s)
139.RE
140
141\-r \fIrel-path\fR
142.br
143\-\-relay=\fIrel-path\fR
144.RS
145Specifies debugfs mount point
146.RE
147
148\-V
149.br
150\-\-version
151Outputs version
152.RE
153
154\-w \fIseconds\fR
155.br
156\-\-stopwatch=\fIseconds\fR
157.RS
158Sets run time to the number of seconds specified
159.RE
160
161
162.SH FILTER MASKS
163The following masks may be passed with the \fI\-a\fR command line
164option, multiple filters may be combined via multiple \fI\-a\fR command
165line options.
166
167.RS
168\fIbarrier\fR: barrier attribute
169.br
170\fIcomplete\fR: completed} by driver
171.br
172\fIfs\fR: requests
173.br
174\fIissue\fR: issued to driver
175.br
176\fIpc\fR: packet command events
177.br
178\fIqueue\fR: queue operations
179.br
180\fIread\fR: read traces
181.br
182\fIrequeue\fR: requeue operations
183.br
184\fIsync\fR: synchronous attribute
185.br
186\fIwrite\fR: write traces
187.RE
188
189
190.SH REQUEST TYPES
191blktrace distinguishes between two types of block layer requests, file system
192and SCSI commands. The former are dubbed \fBfs\fR requests, the latter
193\fBpc\fR requests. File system requests are normal read/write operations, i.e.
194any type of read or write from a specific disk location at a given size. These
195requests typically originate from a user process, but they may also be
196initiated by the vm flushing dirty data to disk or the file system syncing a
197super or journal block to disk. \fBpc\fR requests are SCSI commands. blktrace
198sends the command data block as a payload so that blkparse can decode it.
199
200
201.SH EXAMPLES
202To trace the i/o on the device \fI/dev/hda\fB and parse the output to human
203readable form, use the following command:
204
205 % blktrace \-d /dev/sda \-o \- | blkparse \-i \-
206
207This same behaviour can be achieve with the convenience script \fIbtrace\fR.
208The command
209
210 % btrace /dev/sda
211
212has exactly the same effect as the previous command. See \fIbtrace\fR (8) for
213more information.
214
215To trace the i/o on a device and save the output for later processing with
216\fIblkparse\fR, use \fIblktrace\fR like this:
217
218 % blktrace /dev/sda /dev/sdb
219
220This will trace i/o on the devices \fI/dev/sda\fR and \fI/dev/sdb\fR and save
221the recorded information in the files \fIsda\fR and \fIsdb\fR in the current
222directory, for the two different devices, respectively. This trace
223information can later be parsed by the \fIblkparse\fR utility:
224
225 % blkparse sda sdb
226
227which will output the previously recorded tracing information in human
228readable form to stdout. See \fIblkparse\fR (1) for more information.
229
230
231.SH AUTHORS
232blktrace was written by Jens Axboe, Alan D. Brunelle and Nathan Scott. This
233man page was created from the blktrace documentation by Bas Zoetekouw.
234
235
236.SH "REPORTING BUGS"
237Report bugs to <linux\-btrace@vger.kernel.org>
238
239.SH COPYRIGHT
240Copyright \(co 2006 Jens Axboe, Alan D. Brunelle and Nathan Scott.
241.br
242This is free software. You may redistribute copies of it under the terms of
243the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
244There is NO WARRANTY, to the extent permitted by law.
245.br
246This manual page was created for Debian by Bas Zoetekouw. It was derived from
247the documentation provided by the authors and it may be used, distributed and
248modified under the terms of the GNU General Public License, version 2.
249.br
250On Debian systems, the text of the GNU General Public License can be found in
251/usr/share/common\-licenses/GPL\-2.
252
253.SH "SEE ALSO"
254btrace (8), blkparse (1), verify_blkparse (1), blkrawverify (1), btt (1)
255