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