blkparse: Fix a potential coredump issue
[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
a7263b8f
WZ
168\-S \fIevent\fR
169.br
170\-\-sort\-program\-stats=\fIevent\fR
171.br
172.RS
173Displays each program's data sorted by program name or io event, like
174Queued, Read, Write and Complete. When \-S is specified the \-s will be ignored.
175The capital letters Q,R,W,C stand for KB, then q/r/w/c stand for IO.
176
177If you want to soct programs by how many data they queued, you can use:
178
179blkparse -i sda.blktrace. -q \-S Q \-o sda.parse
180.RE
181
182
98eee4e4
JA
183\-t
184.br
185\-\-track\-ios
186.RS
187Display time deltas per IO
188.RE
189
190\-w \fIspan\fR
191.br
192\-\-stopwatch=\fIspan\fR
193.RS
194Display traces for the \fIspan\fR specified \-\- where span can be:
195.br
196\fIend\-time\fR \-\- Display traces from time 0 through \fIend\-time\fR (in ns)
197.br
198or
199.br
200\fIstart:end\-time\fR \-\- Display traces from time \fIstart\fR
201through end\-time (in ns).
202.RE
203
204\-v
205.br
206\-\-verbose
207.RS
208More verbose marginal on marginal errors
209.RE
210
211\-V
212.br
213\-\-version
214.RS
215Display version
216.RE
217
218
219.SH "TRACE ACTIONS"
220The following trace actions are recognised:
221
222.HP 4
223\fBC -- complete\fR
224A previously issued request has been completed. The output will detail the
225sector and size of that request, as well as the success or failure of it.
226
227.HP 4
228\fBD -- issued\fR
229A request that previously resided on the block layer queue or in the i/o
230scheduler has been sent to the driver.
231
232.HP 4
233\fBI -- inserted\fR
234A request is being sent to the i/o scheduler for addition to the internal queue
235and later service by the driver. The request is fully formed at this time.
236
237.HP 4
238\fBQ -- queued\fR
239This notes intent to queue i/o at the given location. No real requests exists
240yet.
241
242.HP 4
243\fBB -- bounced\fR
244The data pages attached to this \fIbio\fR are not reachable by the hardware
245and must be bounced to a lower memory location. This causes a big slowdown in
246i/o performance, since the data must be copied to/from kernel buffers. Usually
247this can be fixed with using better hardware -- either a better i/o controller,
248or a platform with an IOMMU.
249
250.HP 4
251\fBM -- back merge\fR
252A previously inserted request exists that ends on the boundary of where this i/o
253begins, so the i/o scheduler can merge them together.
254
255.HP 4
256\fBF -- front merge\fR
257Same as the back merge, except this i/o ends where a previously inserted
258requests starts.
259
98eee4e4
JA
260.HP 4
261\fBM -- front or back merge\fR
262One of the above.
263
264.HP 4
265\fBG -- get request\fR
266To send any type of request to a block device, a \fIstruct request\fR
267container must be allocated first.
268
269.HP 4
270\fBS -- sleep\fR
271No available request structures were available, so the issuer has to wait for
272one to be freed.
273
274.HP 4
275\fBP -- plug\fR
276When i/o is queued to a previously empty block device queue, Linux will plug the
277queue in anticipation of future ios being added before this data is needed.
278
279.HP 4
280\fBU -- unplug\fR
281Some request data already queued in the device, start sending requests to the
282driver. This may happen automatically if a timeout period has passed (see next
283entry) or if a number of requests have been added to the queue.
284
285.HP 4
286\fBT -- unplug due to timer\fR
287If nobody requests the i/o that was queued after plugging the queue, Linux will
288automatically unplug it after a defined period has passed.
289
290.HP 4
291\fBX -- split\fR
292On raid or device mapper setups, an incoming i/o may straddle a device or
293internal zone and needs to be chopped up into smaller pieces for service. This
294may indicate a performance problem due to a bad setup of that raid/dm device,
295but may also just be part of normal boundary conditions. dm is notably bad at
296this and will clone lots of i/o.
297
298.HP 4
299\fBA -- remap\fR
300For stacked devices, incoming i/o is remapped to device below it in the i/o
301stack. The remap action details what exactly is being remapped to what.
302
93d9e5b5
WZ
303.HP 4
304\fBR -- requeue\fR
305Put a request back on queue.
306
98eee4e4
JA
307
308
309
310.SH "OUTPUT DESCRIPTION AND FORMATTING"
311
312The output from blkparse can be tailored for specific use -- in particular, to ease
313parsing of output, and/or limit output fields to those the user wants to see. The
314data for fields which can be output include:
315
316.IP \fBa\fR 4
317Action, a (small) string (1 or 2 characters) -- see table below for more details
318
319.IP \fBc\fR 4
320CPU id
321
322.IP \fBC\fR 4
323Command
324
325.IP \fBd\fR 4
326RWBS field, a (small) string (1-3 characters) -- see section below for more details
327
328.IP \fBD\fR 4
3297-character string containing the major and minor numbers of
330the event's device (separated by a comma).
331
332.IP \fBe\fR 4
333Error value
334
7238673f
JK
335.IP \fBg\fR 4
336Cgroup identifier of the cgroup that generated the IO. Note that this requires
337appropriate kernel support (kernel version at least 4.14).
338
98eee4e4
JA
339.IP \fBm\fR 4
340Minor number of event's device.
341
342.IP \fBM\fR 4
343Major number of event's device.
344
345.IP \fBn\fR 4
346Number of blocks
347
348.IP \fBN\fR 4
349Number of bytes
350
351.IP \fBp\fR 4
352Process ID
353
354.IP \fBP\fR 4
355Display packet data \-\- series of hexadecimal values
356
357.IP \fBs\fR 4
358Sequence numbers
359
360.IP \fBS\fR 4
361Sector number
362
363.IP \fBt\fR 4
364Time stamp (nanoseconds)
365
366.IP \fBT\fR 4
367Time stamp (seconds)
368
369.IP \fBu\fR 4
370Elapsed value in microseconds (\fI\-t\fR command line option)
371
372.IP \fBU\fR 4
373Payload unsigned integer
374
09feee84
HM
375.IP \fBz\fR 4
376The absolute time, as local time in your time zone, with no date displayed
377
98eee4e4
JA
378.PP
379Note that the user can optionally specify field display width, and optionally a
380left-aligned specifier. These precede field specifiers, with a '%' character,
381followed by the optional left-alignment specifier (\-) followed by the width (a
382decimal number) and then the field.
383
384Thus, to specify the command in a 12-character field that is left aligned:
385
386 \-f "%\-12C"
387
388
389.SH "ACTION IDENTIFIERS"
390
391The following table shows the various actions which may be output:
392
393.IP A
394IO was remapped to a different device
395
396.IP B
397IO bounced
398
399.IP C
400IO completion
401
402.IP D
403IO issued to driver
404
405.IP F
406IO front merged with request on queue
407
408.IP G
409Get request
410
411.IP I
412IO inserted onto request queue
413
414.IP M
415IO back merged with request on queue
416
417.IP P
418Plug request
419
420.IP Q
421IO handled by request queue code
422
423.IP S
424Sleep request
425
426.IP T
427Unplug due to timeout
428
429.IP U
430Unplug request
431
432.IP X
433Split
434
435
436.SH "RWBS DESCRIPTION"
437
16b952f4 438This is a small string containing characters in the following order:
98eee4e4 439
16b952f4
SH
440.IP F
441Flush
442
443.IP R
444Read
445
446.IP W
447Write
448
449.IP D
450Discard
451
452.IP B
453Barrier
454
455.IP N
456Other operation
457
458.IP F
459Force Unit Access (FUA)
460
461.IP A
462Readahead
463
464.IP S
465Synchronous
466
467.IP M
468Meta
469
470.PP
471One of 'R', 'W', 'D', or 'N' is always present. The other characters are
472optional. Note that 'F' has two meanings, depending on its position.
98eee4e4
JA
473
474.SH "DEFAULT OUTPUT"
475
476The standard header (or initial fields displayed) include:
477
478 "%D %2c %8s %5T.%9t %5p %2a %3d"
479
480Breaking this down:
481
482.IP \fB%D\fR
483Displays the event's device major/minor as: %3d,%\-3d.
484
485.IP \fB%2c\fR
486CPU ID (2-character field).
487
488.IP \fB%8s\fR
489Sequence number
490
491.IP \fB%5T.%9t\fR
4925-character field for the seconds portion of the time stamp and a 9-character field for the nanoseconds in the time stamp.
493
494.IP \fB%5p\fR
4955-character field for the process ID.
496
497.IP \fB%2a\fR
4982-character field for one of the actions.
499
500.IP \fB%3d\fR
5013-character field for the RWBS data.
502
503Seeing this in action:
504
505 8,0 3 1 0.000000000 697 G W 223490 + 8 [kjournald]
506
507The header is the data in this line up to the 223490 (starting block).
508The default output for all event types includes this header.
509
510
511
512.SH "DEFAULT OUTPUT PER ACTION"
513
514\fBC \-\- complete\fR
515.RS 4
516If a payload is present, this is presented between
517parenthesis following the header, followed by the error value.
518
519If no payload is present, the sector and number of blocks are presented
520(with an intervening plus (+) character). If the \fB\-t\fR option
521was specified, then the elapsed time is presented. In either case,
522it is followed by the error value for the completion.
523.RE
524
525\fBB \-\- bounced\fR
526.br
527\fBD \-\- issued\fR
528.br
529\fBI \-\- inserted\fR
530.br
531\fBQ \-\- queued\fR
532.RS 4
533If a payload is present, the number of payload bytes
534is output, followed by the payload in hexadecimal between parenthesis.
535
536If no payload is present, the sector and number of blocks are presented
537(with an intervening plus (+) character). If the \fB\-t\fR option was
538specified, then the elapsed time is presented (in parenthesis). In
539either case, it is followed by the command associated with the event
540(surrounded by square brackets).
541.RE
542
543\fBF \-\- front merge\fR
544.br
545\fBG \-\- get request\fR
546.br
547\fBM \-\- back merge\fR
548.br
549\fBS \-\- sleep\fR
550.RS 4
551The starting sector and number of blocks is output
552(with an intervening plus (+) character), followed by the command
553associated with the event (surrounded by square brackets).
554.RE
555
556\fBP \-\- plug\fR
557.RS 4
558The command associated with the event (surrounded by
559square brackets) is output.
560.RE
561
562\fBU \-\- unplug\fR
563.br
564\fBT \-\- unplug due to timer\fR
565.RS 4
566The command associated with the event
567(surrounded by square brackets) is output, followed by the number of
568requests outstanding.
569.RE
570
571\fBX \-\- split\fR
572.RS 4
573The original starting sector followed by the new
574sector (separated by a slash (/) is output, followed by the command
575associated with the event (surrounded by square brackets).
576.RE
577
578\fBA \-\- remap\fR
579.RS 4
580Sector and length is output, along with the original
581device and sector offset.
582.RE
583
584
585.SH EXAMPLES
88d38b4d 586To trace the i/o on the device \fI/dev/sda\fB and parse the output to human
98eee4e4
JA
587readable form, use the following command:
588
589 % blktrace \-d /dev/sda \-o \- | blkparse \-i \-
590
591(see \fIblktrace\fR (8) for more information).
592This same behaviour can be achieve with the convenience script \fIbtrace\fR.
593The command
594
595 % btrace /dev/sda
596
597has exactly the same effect as the previous command. See \fIbtrace\fR (8) for
598more information.
599
600To trace the i/o on a device and save the output for later processing with
601\fIblkparse\fR, use \fIblktrace\fR like this:
602
603 % blktrace /dev/sda /dev/sdb
604
605This will trace i/o on the devices \fI/dev/sda\fR and \fI/dev/sdb\fR and save
606the recorded information in the files \fIsda\fR and \fIsdb\fR in the current
607directory, for the two different devices, respectively. This trace
608information can later be parsed by the \fIblkparse\fR utility:
609
610 % blkparse sda sdb
611
612which will output the previously recorded tracing information in human
613readable form to stdout.
614
615
616.SH AUTHORS
617\fIblkparse\fR was written by Jens Axboe, Alan D. Brunelle and Nathan Scott. This
618man page was created from the \fIblktrace\fR documentation by Bas Zoetekouw.
619
620
621.SH "REPORTING BUGS"
622Report bugs to <linux\-btrace@vger.kernel.org>
623
624.SH COPYRIGHT
625Copyright \(co 2006 Jens Axboe, Alan D. Brunelle and Nathan Scott.
626.br
627This is free software. You may redistribute copies of it under the terms of
628the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
629There is NO WARRANTY, to the extent permitted by law.
630.br
631This manual page was created for Debian by Bas Zoetekouw. It was derived from
632the documentation provided by the authors and it may be used, distributed and
633modified under the terms of the GNU General Public License, version 2.
634.br
635On Debian systems, the text of the GNU General Public License can be found in
636/usr/share/common\-licenses/GPL\-2.
637
638.SH "SEE ALSO"
639btrace (8), blktrace (8), verify_blkparse (1), blkrawverify (1), btt (1)
640