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