iowatcher: check the return value from write()
[blktrace.git] / doc / blkparse.1
CommitLineData
fbdf23ec 1.TH BLKPARSE 1 "March 6, 2007" "blktrace git\-20070306202522" ""
98eee4e4
JA
2
3
4.SH NAME
5blkparse \- produce formatted output of event streams of block devices
6
7
8.SH SYNOPSIS
9.B blkparse [ \fIoptions\fR ]
10.br
11
12
13.SH DESCRIPTION
14The \fIblkparse\fR utility will attempt to combine streams of events for
15various devices on various CPUs, and produce a formatted output of the event
16information. Specifically, it will take the (machine-readable) output of the
17\fIblktrace\fR utility and convert it to a nicely formatted and human-readable
18form.
19
20As with \fIblktrace\fR, some details concerning \fIblkparse\fR
21will help in understanding the command line options presented below.
22
23
24.TP 2
25\-
26By default, \fIblkparse\fR expects to run in a post-processing mode; one where
27the trace events have been saved by a previous run of blktrace, and blkparse
28is combining event streams and dumping formatted data.
29
30blkparse may be run in a live manner concurrently with blktrace by specifying
31\fB\-i \-\fR to blkparse, and combining it with the live option for blktrace.
32An example would be:
33
34 % blktrace \-d /dev/sda \-o \- | blkparse \-i \-
35
36.TP 2
37\-
38You can set how many blkparse batches event reads via the \fB\-b\fR option, the
39default is to handle events in batches of 512.
40
41.TP 2
42\-
43If you have saved event traces in blktrace with different output names (via
44the \fB\-o\fR option to blktrace), you must specify the same input name via the
45\fB\-i\fR option.
46
47.TP 2
48\-
49The format of the output data can be controlled via the \fB\-f\fR or \fB\-F\fR
50options \-\- see OUTPUT DESCRIPTION AND FORMATTING for details.
51
52.PP
53By default, blkparse sends formatted data to standard output. This may
54be changed via the \fB\-o\fR option, or text output can be disabled via the
55\fB\-O\fR option. A merged binary stream can be produced using the \fB\-d\fR
56option.
57
58
59
60.SH OPTIONS
541c9bf6
ES
61\-A \fIhex-mask\fR
62.br
63\-\-set-mask=\fIhex-mask\fR
64.RS
65Set filter mask to \fIhex-mask\fR, see blktrace (8) for masks
66.RE
67
68\-a \fImask\fR
69.br
70\-\-act-mask=\fImask\fR
71.RS
72Add \fImask\fR to current filter, see blktrace (8) for masks
73.RE
74
75\-D \fIdir\fR
76.br
77\-\-input-directory=\fIdir\fR
78.RS
79Prepend \fIdir\fR to input file names
80.RE
98eee4e4
JA
81
82\-b \fIbatch\fR
83.br
84\-\-batch={batch}
85.RS
86Standard input read batching
87.RE
88
89\-i \fIfile\fR
90.br
91\-\-input=\fIfile\fR
92.RS
93Specifies base name for input files \-\- default is \fIdevice\fR.blktrace.\fIcpu\fR.
94
95As noted above, specifying \fB\-i \-\fR runs in live mode with blktrace
96(reading data from standard in).
97.RE
98
99\-F \fItyp,fmt\fR
100.br
101\-\-format=\fItyp,fmt\fR
102.br
103\-f \fIfmt\fR
104.br
105\-\-format\-spec=\fIfmt\fR
106.RS
107Sets output format
108(See OUTPUT DESCRIPTION AND FORMATTING for details.)
109
110The \-f form specifies a format for all events
111
112The \-F form allows one to specify a format for a specific
113event type. The single\-character \fItyp\fR field is one of the
114action specifiers described in ACTION IDENTIFIERS.
115.RE
116
19cfaf3f
AB
117\-M
118.br
119\-\-no-msgs
120.RS
121When \-d is specified, this will stop messages from being output to the
122file. (Can seriously reduce the size of the resultant file when using
123the CFQ I/O scheduler.)
124.RE
125
98eee4e4
JA
126\-h
127.br
128\-\-hash\-by\-name
129.RS
130Hash processes by name, not by PID
131.RE
132
133\-o \fIfile\fR
134.br
135\-\-output=\fIfile\fR
136.RS
137Output file
138.RE
139
140\-O
141.br
142\-\-no\-text\-output
143.RS
144Do \fInot\fR produce text output, used for binary (\fB\-d\fR) only
145.RE
146
147\-d \fIfile\fR
148.br
149\-\-dump\-binary=\fIfile\fR
150.RS
151Binary output file
152.RE
153
154\-q
155.br
156\-\-quiet
157.RS
158Quiet mode
159.RE
160
161\-s
162.br
163\-\-per\-program\-stats
164.RS
165Displays data sorted by program
166.RE
167
168\-t
169.br
170\-\-track\-ios
171.RS
172Display time deltas per IO
173.RE
174
175\-w \fIspan\fR
176.br
177\-\-stopwatch=\fIspan\fR
178.RS
179Display traces for the \fIspan\fR specified \-\- where span can be:
180.br
181\fIend\-time\fR \-\- Display traces from time 0 through \fIend\-time\fR (in ns)
182.br
183or
184.br
185\fIstart:end\-time\fR \-\- Display traces from time \fIstart\fR
186through end\-time (in ns).
187.RE
188
189\-v
190.br
191\-\-verbose
192.RS
193More verbose marginal on marginal errors
194.RE
195
196\-V
197.br
198\-\-version
199.RS
200Display version
201.RE
202
203
204.SH "TRACE ACTIONS"
205The following trace actions are recognised:
206
207.HP 4
208\fBC -- complete\fR
209A previously issued request has been completed. The output will detail the
210sector and size of that request, as well as the success or failure of it.
211
212.HP 4
213\fBD -- issued\fR
214A request that previously resided on the block layer queue or in the i/o
215scheduler has been sent to the driver.
216
217.HP 4
218\fBI -- inserted\fR
219A request is being sent to the i/o scheduler for addition to the internal queue
220and later service by the driver. The request is fully formed at this time.
221
222.HP 4
223\fBQ -- queued\fR
224This notes intent to queue i/o at the given location. No real requests exists
225yet.
226
227.HP 4
228\fBB -- bounced\fR
229The data pages attached to this \fIbio\fR are not reachable by the hardware
230and must be bounced to a lower memory location. This causes a big slowdown in
231i/o performance, since the data must be copied to/from kernel buffers. Usually
232this can be fixed with using better hardware -- either a better i/o controller,
233or a platform with an IOMMU.
234
235.HP 4
236\fBM -- back merge\fR
237A previously inserted request exists that ends on the boundary of where this i/o
238begins, so the i/o scheduler can merge them together.
239
240.HP 4
241\fBF -- front merge\fR
242Same as the back merge, except this i/o ends where a previously inserted
243requests starts.
244
245.HP 4
246\fBM --front or back merge\fR
247One of the above
248
249.HP 4
250\fBM -- front or back merge\fR
251One of the above.
252
253.HP 4
254\fBG -- get request\fR
255To send any type of request to a block device, a \fIstruct request\fR
256container must be allocated first.
257
258.HP 4
259\fBS -- sleep\fR
260No available request structures were available, so the issuer has to wait for
261one to be freed.
262
263.HP 4
264\fBP -- plug\fR
265When i/o is queued to a previously empty block device queue, Linux will plug the
266queue in anticipation of future ios being added before this data is needed.
267
268.HP 4
269\fBU -- unplug\fR
270Some request data already queued in the device, start sending requests to the
271driver. This may happen automatically if a timeout period has passed (see next
272entry) or if a number of requests have been added to the queue.
273
274.HP 4
275\fBT -- unplug due to timer\fR
276If nobody requests the i/o that was queued after plugging the queue, Linux will
277automatically unplug it after a defined period has passed.
278
279.HP 4
280\fBX -- split\fR
281On raid or device mapper setups, an incoming i/o may straddle a device or
282internal zone and needs to be chopped up into smaller pieces for service. This
283may indicate a performance problem due to a bad setup of that raid/dm device,
284but may also just be part of normal boundary conditions. dm is notably bad at
285this and will clone lots of i/o.
286
287.HP 4
288\fBA -- remap\fR
289For stacked devices, incoming i/o is remapped to device below it in the i/o
290stack. The remap action details what exactly is being remapped to what.
291
292
293
294
295.SH "OUTPUT DESCRIPTION AND FORMATTING"
296
297The output from blkparse can be tailored for specific use -- in particular, to ease
298parsing of output, and/or limit output fields to those the user wants to see. The
299data for fields which can be output include:
300
301.IP \fBa\fR 4
302Action, a (small) string (1 or 2 characters) -- see table below for more details
303
304.IP \fBc\fR 4
305CPU id
306
307.IP \fBC\fR 4
308Command
309
310.IP \fBd\fR 4
311RWBS field, a (small) string (1-3 characters) -- see section below for more details
312
313.IP \fBD\fR 4
3147-character string containing the major and minor numbers of
315the event's device (separated by a comma).
316
317.IP \fBe\fR 4
318Error value
319
320.IP \fBm\fR 4
321Minor number of event's device.
322
323.IP \fBM\fR 4
324Major number of event's device.
325
326.IP \fBn\fR 4
327Number of blocks
328
329.IP \fBN\fR 4
330Number of bytes
331
332.IP \fBp\fR 4
333Process ID
334
335.IP \fBP\fR 4
336Display packet data \-\- series of hexadecimal values
337
338.IP \fBs\fR 4
339Sequence numbers
340
341.IP \fBS\fR 4
342Sector number
343
344.IP \fBt\fR 4
345Time stamp (nanoseconds)
346
347.IP \fBT\fR 4
348Time stamp (seconds)
349
350.IP \fBu\fR 4
351Elapsed value in microseconds (\fI\-t\fR command line option)
352
353.IP \fBU\fR 4
354Payload unsigned integer
355
356.PP
357Note that the user can optionally specify field display width, and optionally a
358left-aligned specifier. These precede field specifiers, with a '%' character,
359followed by the optional left-alignment specifier (\-) followed by the width (a
360decimal number) and then the field.
361
362Thus, to specify the command in a 12-character field that is left aligned:
363
364 \-f "%\-12C"
365
366
367.SH "ACTION IDENTIFIERS"
368
369The following table shows the various actions which may be output:
370
371.IP A
372IO was remapped to a different device
373
374.IP B
375IO bounced
376
377.IP C
378IO completion
379
380.IP D
381IO issued to driver
382
383.IP F
384IO front merged with request on queue
385
386.IP G
387Get request
388
389.IP I
390IO inserted onto request queue
391
392.IP M
393IO back merged with request on queue
394
395.IP P
396Plug request
397
398.IP Q
399IO handled by request queue code
400
401.IP S
402Sleep request
403
404.IP T
405Unplug due to timeout
406
407.IP U
408Unplug request
409
410.IP X
411Split
412
413
414.SH "RWBS DESCRIPTION"
415
64c03161
DW
416This is a small string containing at least one character ('R' for read, 'W'
417for write, or 'D' for block discard operation), and optionally either
418a 'B' (for barrier operations) or 'S' (for synchronous operations).
98eee4e4
JA
419
420
421.SH "DEFAULT OUTPUT"
422
423The standard header (or initial fields displayed) include:
424
425 "%D %2c %8s %5T.%9t %5p %2a %3d"
426
427Breaking this down:
428
429.IP \fB%D\fR
430Displays the event's device major/minor as: %3d,%\-3d.
431
432.IP \fB%2c\fR
433CPU ID (2-character field).
434
435.IP \fB%8s\fR
436Sequence number
437
438.IP \fB%5T.%9t\fR
4395-character field for the seconds portion of the time stamp and a 9-character field for the nanoseconds in the time stamp.
440
441.IP \fB%5p\fR
4425-character field for the process ID.
443
444.IP \fB%2a\fR
4452-character field for one of the actions.
446
447.IP \fB%3d\fR
4483-character field for the RWBS data.
449
450Seeing this in action:
451
452 8,0 3 1 0.000000000 697 G W 223490 + 8 [kjournald]
453
454The header is the data in this line up to the 223490 (starting block).
455The default output for all event types includes this header.
456
457
458
459.SH "DEFAULT OUTPUT PER ACTION"
460
461\fBC \-\- complete\fR
462.RS 4
463If a payload is present, this is presented between
464parenthesis following the header, followed by the error value.
465
466If no payload is present, the sector and number of blocks are presented
467(with an intervening plus (+) character). If the \fB\-t\fR option
468was specified, then the elapsed time is presented. In either case,
469it is followed by the error value for the completion.
470.RE
471
472\fBB \-\- bounced\fR
473.br
474\fBD \-\- issued\fR
475.br
476\fBI \-\- inserted\fR
477.br
478\fBQ \-\- queued\fR
479.RS 4
480If a payload is present, the number of payload bytes
481is output, followed by the payload in hexadecimal between parenthesis.
482
483If no payload is present, the sector and number of blocks are presented
484(with an intervening plus (+) character). If the \fB\-t\fR option was
485specified, then the elapsed time is presented (in parenthesis). In
486either case, it is followed by the command associated with the event
487(surrounded by square brackets).
488.RE
489
490\fBF \-\- front merge\fR
491.br
492\fBG \-\- get request\fR
493.br
494\fBM \-\- back merge\fR
495.br
496\fBS \-\- sleep\fR
497.RS 4
498The starting sector and number of blocks is output
499(with an intervening plus (+) character), followed by the command
500associated with the event (surrounded by square brackets).
501.RE
502
503\fBP \-\- plug\fR
504.RS 4
505The command associated with the event (surrounded by
506square brackets) is output.
507.RE
508
509\fBU \-\- unplug\fR
510.br
511\fBT \-\- unplug due to timer\fR
512.RS 4
513The command associated with the event
514(surrounded by square brackets) is output, followed by the number of
515requests outstanding.
516.RE
517
518\fBX \-\- split\fR
519.RS 4
520The original starting sector followed by the new
521sector (separated by a slash (/) is output, followed by the command
522associated with the event (surrounded by square brackets).
523.RE
524
525\fBA \-\- remap\fR
526.RS 4
527Sector and length is output, along with the original
528device and sector offset.
529.RE
530
531
532.SH EXAMPLES
533To trace the i/o on the device \fI/dev/hda\fB and parse the output to human
534readable form, use the following command:
535
536 % blktrace \-d /dev/sda \-o \- | blkparse \-i \-
537
538(see \fIblktrace\fR (8) for more information).
539This same behaviour can be achieve with the convenience script \fIbtrace\fR.
540The command
541
542 % btrace /dev/sda
543
544has exactly the same effect as the previous command. See \fIbtrace\fR (8) for
545more information.
546
547To trace the i/o on a device and save the output for later processing with
548\fIblkparse\fR, use \fIblktrace\fR like this:
549
550 % blktrace /dev/sda /dev/sdb
551
552This will trace i/o on the devices \fI/dev/sda\fR and \fI/dev/sdb\fR and save
553the recorded information in the files \fIsda\fR and \fIsdb\fR in the current
554directory, for the two different devices, respectively. This trace
555information can later be parsed by the \fIblkparse\fR utility:
556
557 % blkparse sda sdb
558
559which will output the previously recorded tracing information in human
560readable form to stdout.
561
562
563.SH AUTHORS
564\fIblkparse\fR was written by Jens Axboe, Alan D. Brunelle and Nathan Scott. This
565man page was created from the \fIblktrace\fR documentation by Bas Zoetekouw.
566
567
568.SH "REPORTING BUGS"
569Report bugs to <linux\-btrace@vger.kernel.org>
570
571.SH COPYRIGHT
572Copyright \(co 2006 Jens Axboe, Alan D. Brunelle and Nathan Scott.
573.br
574This is free software. You may redistribute copies of it under the terms of
575the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
576There is NO WARRANTY, to the extent permitted by law.
577.br
578This manual page was created for Debian by Bas Zoetekouw. It was derived from
579the documentation provided by the authors and it may be used, distributed and
580modified under the terms of the GNU General Public License, version 2.
581.br
582On Debian systems, the text of the GNU General Public License can be found in
583/usr/share/common\-licenses/GPL\-2.
584
585.SH "SEE ALSO"
586btrace (8), blktrace (8), verify_blkparse (1), blkrawverify (1), btt (1)
587