Commit | Line | Data |
---|---|---|
d0ca268b JA |
1 | Block IO Tracing |
2 | ---------------- | |
3 | ||
46e37c55 | 4 | Written by Jens Axboe <axboe@kernel.dk> (initial version and kernel support), |
e7c9f3ff NS |
5 | Alan D. Brunelle (threading and splitup into two seperate programs), |
6 | Nathan Scott <nathans@sgi.com> (bug fixes, process names, multiple devices) | |
05831aca JA |
7 | Also thanks to Tom Zanussi <zanussi@us.ibm.com> for good input and |
8 | patches. | |
d0ca268b JA |
9 | |
10 | ||
c1bd9d09 JA |
11 | Requirements |
12 | ------------ | |
13 | ||
c8255c5a | 14 | blktrace was integrated into the mainline kernel between 2.6.16 and 2.6.17-rc1. |
fe92fbb8 | 15 | The target trace needs to run on a kernel at least that new. |
c1bd9d09 | 16 | |
fe92fbb8 | 17 | git://git.kernel.dk/data/git/blktrace.git |
c1bd9d09 | 18 | |
6432fd98 JA |
19 | If you don't have git, you can get hourly snapshots from: |
20 | ||
fe92fbb8 | 21 | http://brick.kernel.dk/snaps/ |
6432fd98 | 22 | |
b2a8adbf JA |
23 | The snapshots include the full git object database as well. kernel.org has |
24 | excessively long mirror times, so if you have git installed, you can pull | |
25 | the master tree from: | |
26 | ||
fe92fbb8 | 27 | git://git.kernel.dk/data/git/blktrace.git |
6432fd98 | 28 | |
ab9b41a7 JA |
29 | For browsing the repo over http and viewing history etc, you can direct |
30 | your browser to: | |
31 | ||
871ef6d0 | 32 | http://git.kernel.dk/ |
ab9b41a7 | 33 | |
c1bd9d09 JA |
34 | |
35 | Usage | |
36 | ----- | |
37 | ||
e94cf8d7 | 38 | $ blktrace -d <dev> [ -r debug_path ] [ -o output ] [ -k ] [ -w time ] |
ab197ca7 AB |
39 | [ -a action ] [ -A action mask ] |
40 | ||
41 | -d Use specified device. May also be given last after options. | |
e94cf8d7 | 42 | -r Path to mounted debugfs, defaults to /debug. |
ab197ca7 | 43 | -o File(s) to send output to. |
d1d7f15f | 44 | -D Directory to prepend to output file names. |
ab197ca7 AB |
45 | -k Kill running trace. |
46 | -w Stop after defined time, in seconds. | |
47 | -a Only trace specific actions (use more -a options to add actions). | |
48 | Available actions are: | |
49 | ||
d0009925 JA |
50 | READ |
51 | WRITE | |
52 | BARRIER | |
53 | SYNC | |
54 | QUEUE | |
55 | REQUEUE | |
56 | ISSUE | |
57 | COMPLETE | |
58 | FS | |
59 | PC | |
ab197ca7 AB |
60 | |
61 | -A Give the trace mask directly as a number. | |
62 | ||
129aa440 JA |
63 | -b Sub buffer size in KiB. |
64 | -n Number of sub buffers. | |
f531b94d JA |
65 | -l Run in network listen mode (blktrace server) |
66 | -h Run in network client mode, connecting to the given host | |
67 | -p Network port to use (default 8462) | |
79971f43 | 68 | -s Disable network client use of sendfile() to transfer data |
57ea8602 | 69 | -V Print program version info. |
52724a0e | 70 | |
ab197ca7 AB |
71 | $ blkparse -i <input> [ -o <output> ] [ -b rb_batch ] [ -s ] [ -t ] [ -q ] |
72 | [ -w start:stop ] [ -f output format ] [ -F format spec ] | |
a2594911 | 73 | [ -d <binary> ] |
ab197ca7 AB |
74 | |
75 | -i Input file containing trace data, or '-' for stdin. | |
d1d7f15f | 76 | -D Directory to prepend to input file names. |
ab197ca7 AB |
77 | -o Output file. If not given, output is stdout. |
78 | -b stdin read batching. | |
79 | -s Show per-program io statistics. | |
d915dee6 | 80 | -h Hash processes by name, not pid. |
ab197ca7 AB |
81 | -t Track individual ios. Will tell you the time a request took to |
82 | get queued, to get dispatched, and to get completed. | |
83 | -q Quiet. Don't display any stats at the end of the trace. | |
84 | -w Only parse data between the given time interval in seconds. If | |
85 | 'start' isn't given, blkparse defaults the start time to 0. | |
a2594911 | 86 | -d Dump sorted data in binary format |
ab197ca7 AB |
87 | -f Output format. Customize the output format. The format field |
88 | identifiers are: | |
89 | ||
90 | %a - Action | |
91 | %c - CPU ID | |
92 | %C - Task command name | |
93 | %d - Direction (r/w) | |
94 | %D - Device number | |
95 | %e - Error number | |
96 | %M - Major | |
97 | %m - Minor | |
1c8ca7b5 JA |
98 | %N - Number of bytes |
99 | %n - Number of sectors | |
ab197ca7 AB |
100 | %p - PID |
101 | %P - PDU | |
102 | %s - Sequence number | |
103 | %S - Sector number | |
104 | %t - Time (wallclock - nanoseconds) | |
105 | %T - Time (wallclock - seconds) | |
106 | %u - Time (processing - microseconds) | |
638c1923 | 107 | %U - Unplug depth |
ab197ca7 AB |
108 | |
109 | -F Format specification. The individual specifiers are: | |
110 | ||
a8f30e64 | 111 | A - Remap |
ab197ca7 AB |
112 | B - Back merge |
113 | C - Complete | |
114 | D - Issue | |
115 | F - Front merge | |
116 | G - Get request | |
b6076a9b | 117 | I - Insert |
ab197ca7 AB |
118 | M - Both front and back merge |
119 | P - Plug | |
120 | Q - Queue | |
121 | R - Requeue | |
122 | S - Sleep requests | |
123 | T - Unplug timer | |
124 | U - Unplug IO | |
93f1c611 JA |
125 | W - Bounce |
126 | X - Split | |
c1bd9d09 | 127 | |
57ea8602 JA |
128 | -v More verbose for marginal errors. |
129 | -V Print program version info. | |
c1bd9d09 | 130 | |
54aa4b1c JA |
131 | $ verify_blkparse filename |
132 | ||
133 | Verifies an output file from blkparse. All it does is check if | |
134 | the events in the file are correctly time ordered. If an entry | |
135 | is found that isn't ordered, it's dumped to stdout. | |
136 | ||
f17c879d AB |
137 | $ blkrawverify <dev> [<dev>...] |
138 | ||
139 | The blkrawverify utility can be used to verify data retrieved | |
140 | via blktrace. It will check for valid event formats, forward | |
141 | progressing sequence numbers and time stamps, also does reasonable | |
142 | checks for other potential issues within invidividual events. | |
143 | ||
144 | Errors found will be tracked in <dev>.verify.out. | |
54aa4b1c | 145 | |
d0009925 JA |
146 | If you want to do live tracing, you can pipe the data between blktrace |
147 | and blkparse: | |
148 | ||
149 | % blktrace -d <device> -o - | blkparse -i - | |
150 | ||
151 | This has a small risk of displaying some traces a little out of sync, since | |
152 | it will do batch sorts of input events. Similarly, you can do traces over | |
f531b94d | 153 | the network. The network 'server' must run: |
d0009925 | 154 | |
f531b94d JA |
155 | % blktrace -l |
156 | ||
157 | to listen to incoming blktrace connections, while the client should use | |
158 | ||
159 | % blktrace -d /dev/sda -h <server hostname> | |
160 | ||
161 | to connect and transfer data over the network. | |
d0009925 | 162 | |
d0009925 | 163 | |
b47d077d JA |
164 | Documentation |
165 | ------------- | |
166 | ||
167 | A users guide is distributed with the source. It is in latex, a | |
d372b4d9 JA |
168 | 'make docs' will build a PDF in doc/. You need tetex and latex installed |
169 | to build the document. | |
b47d077d JA |
170 | |
171 | ||
8d99d141 JA |
172 | Resources |
173 | --------- | |
174 | ||
175 | vger hosts a mailing list dedicated to btrace discussion and development. | |
176 | The list is called linux-btrace@vger.kernel.org, subscribe by sending | |
177 | a mail to majordomo@vger.kernel.org with 'subscribe linux-btrace' in | |
178 | the mail body. | |
179 | ||
180 | ||
181 | ||
46e37c55 | 182 | 2006-09-05, Jens Axboe <axboe@kernel.dk> |
c1bd9d09 | 183 |