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