Commit | Line | Data |
---|---|---|
d0ca268b JA |
1 | Block IO Tracing |
2 | ---------------- | |
3 | ||
e7c9f3ff NS |
4 | Written by Jens Axboe <axboe@suse.de> (initial version and kernel support), |
5 | Alan D. Brunelle (threading and splitup into two seperate programs), | |
6 | Nathan Scott <nathans@sgi.com> (bug fixes, process names, multiple devices) | |
d0ca268b JA |
7 | |
8 | ||
c1bd9d09 JA |
9 | Requirements |
10 | ------------ | |
11 | ||
b2a8adbf | 12 | You need to be running a 2.6.14-rc2 kernel or newer, with the blk-trace patch |
56c7d54d | 13 | included in this repository. If you forgot where you got it, the url is: |
c1bd9d09 JA |
14 | |
15 | rsync://rsync.kernel.org/pub/scm/linux/kernel/git/axboe/blktrace.git | |
16 | ||
6432fd98 JA |
17 | If you don't have git, you can get hourly snapshots from: |
18 | ||
19 | http://www.kernel.org/pub/linux/kernel/people/axboe/blktrace/ | |
20 | ||
b2a8adbf JA |
21 | The snapshots include the full git object database as well. kernel.org has |
22 | excessively long mirror times, so if you have git installed, you can pull | |
23 | the master tree from: | |
24 | ||
25 | git://brick.kernel.dk/data/git/blktrace.git | |
6432fd98 | 26 | |
ab9b41a7 JA |
27 | For browsing the repo over http and viewing history etc, you can direct |
28 | your browser to: | |
29 | ||
30 | http://brick.kernel.dk/git | |
31 | ||
c1bd9d09 JA |
32 | |
33 | Usage | |
34 | ----- | |
35 | ||
ab197ca7 AB |
36 | $ blktrace -d <dev> [ -r relay_path ] [ -o output ] [ -k ] [ -w time ] |
37 | [ -a action ] [ -A action mask ] | |
38 | ||
39 | -d Use specified device. May also be given last after options. | |
40 | -r Path to mounted relayfs, defaults to /relay. | |
41 | -o File(s) to send output to. | |
42 | -k Kill running trace. | |
43 | -w Stop after defined time, in seconds. | |
44 | -a Only trace specific actions (use more -a options to add actions). | |
45 | Available actions are: | |
46 | ||
d0009925 JA |
47 | READ |
48 | WRITE | |
49 | BARRIER | |
50 | SYNC | |
51 | QUEUE | |
52 | REQUEUE | |
53 | ISSUE | |
54 | COMPLETE | |
55 | FS | |
56 | PC | |
ab197ca7 AB |
57 | |
58 | -A Give the trace mask directly as a number. | |
59 | ||
52724a0e | 60 | -v Print program version info. |
129aa440 JA |
61 | -b Sub buffer size in KiB. |
62 | -n Number of sub buffers. | |
52724a0e | 63 | |
ab197ca7 AB |
64 | $ blkparse -i <input> [ -o <output> ] [ -b rb_batch ] [ -s ] [ -t ] [ -q ] |
65 | [ -w start:stop ] [ -f output format ] [ -F format spec ] | |
66 | ||
67 | -i Input file containing trace data, or '-' for stdin. | |
68 | -o Output file. If not given, output is stdout. | |
69 | -b stdin read batching. | |
70 | -s Show per-program io statistics. | |
bf0720af | 71 | -n Hash processes by name, not pid. |
ab197ca7 AB |
72 | -t Track individual ios. Will tell you the time a request took to |
73 | get queued, to get dispatched, and to get completed. | |
74 | -q Quiet. Don't display any stats at the end of the trace. | |
75 | -w Only parse data between the given time interval in seconds. If | |
76 | 'start' isn't given, blkparse defaults the start time to 0. | |
77 | -f Output format. Customize the output format. The format field | |
78 | identifiers are: | |
79 | ||
80 | %a - Action | |
81 | %c - CPU ID | |
82 | %C - Task command name | |
83 | %d - Direction (r/w) | |
84 | %D - Device number | |
85 | %e - Error number | |
86 | %M - Major | |
87 | %m - Minor | |
1c8ca7b5 JA |
88 | %N - Number of bytes |
89 | %n - Number of sectors | |
ab197ca7 AB |
90 | %p - PID |
91 | %P - PDU | |
92 | %s - Sequence number | |
93 | %S - Sector number | |
94 | %t - Time (wallclock - nanoseconds) | |
95 | %T - Time (wallclock - seconds) | |
96 | %u - Time (processing - microseconds) | |
638c1923 | 97 | %U - Unplug depth |
ab197ca7 AB |
98 | |
99 | -F Format specification. The individual specifiers are: | |
100 | ||
101 | B - Back merge | |
102 | C - Complete | |
103 | D - Issue | |
104 | F - Front merge | |
105 | G - Get request | |
b6076a9b | 106 | I - Insert |
ab197ca7 AB |
107 | M - Both front and back merge |
108 | P - Plug | |
109 | Q - Queue | |
110 | R - Requeue | |
111 | S - Sleep requests | |
112 | T - Unplug timer | |
113 | U - Unplug IO | |
93f1c611 JA |
114 | W - Bounce |
115 | X - Split | |
c1bd9d09 | 116 | |
7d1c0411 | 117 | -m Print missing entries. |
52724a0e | 118 | -v Print program version info. |
c1bd9d09 | 119 | |
54aa4b1c JA |
120 | $ verify_blkparse filename |
121 | ||
122 | Verifies an output file from blkparse. All it does is check if | |
123 | the events in the file are correctly time ordered. If an entry | |
124 | is found that isn't ordered, it's dumped to stdout. | |
125 | ||
126 | ||
d0009925 JA |
127 | If you want to do live tracing, you can pipe the data between blktrace |
128 | and blkparse: | |
129 | ||
130 | % blktrace -d <device> -o - | blkparse -i - | |
131 | ||
132 | This has a small risk of displaying some traces a little out of sync, since | |
133 | it will do batch sorts of input events. Similarly, you can do traces over | |
134 | the network with eg netcat: | |
135 | ||
136 | % blktrace -d /dev/sda -o - | netcat parsehost portno | |
ebc37a0b | 137 | % netcat -l -p portno tracehost | blkparse -i - |
d0009925 JA |
138 | |
139 | Which will send the traces from tracehost to parsehost over the network on | |
140 | the defined port number. | |
141 | ||
142 | ||
8d99d141 JA |
143 | Resources |
144 | --------- | |
145 | ||
146 | vger hosts a mailing list dedicated to btrace discussion and development. | |
147 | The list is called linux-btrace@vger.kernel.org, subscribe by sending | |
148 | a mail to majordomo@vger.kernel.org with 'subscribe linux-btrace' in | |
149 | the mail body. | |
150 | ||
151 | ||
152 | ||
d0009925 | 153 | 20050906, Jens Axboe <axboe@suse.de> |
c1bd9d09 | 154 |