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 | |
c1bd9d09 JA |
27 | |
28 | Usage | |
29 | ----- | |
30 | ||
ab197ca7 AB |
31 | $ blktrace -d <dev> [ -r relay_path ] [ -o output ] [ -k ] [ -w time ] |
32 | [ -a action ] [ -A action mask ] | |
33 | ||
34 | -d Use specified device. May also be given last after options. | |
35 | -r Path to mounted relayfs, defaults to /relay. | |
36 | -o File(s) to send output to. | |
37 | -k Kill running trace. | |
38 | -w Stop after defined time, in seconds. | |
39 | -a Only trace specific actions (use more -a options to add actions). | |
40 | Available actions are: | |
41 | ||
d0009925 JA |
42 | READ |
43 | WRITE | |
44 | BARRIER | |
45 | SYNC | |
46 | QUEUE | |
47 | REQUEUE | |
48 | ISSUE | |
49 | COMPLETE | |
50 | FS | |
51 | PC | |
ab197ca7 AB |
52 | |
53 | -A Give the trace mask directly as a number. | |
54 | ||
52724a0e JA |
55 | -v Print program version info. |
56 | ||
ab197ca7 AB |
57 | $ blkparse -i <input> [ -o <output> ] [ -b rb_batch ] [ -s ] [ -t ] [ -q ] |
58 | [ -w start:stop ] [ -f output format ] [ -F format spec ] | |
59 | ||
60 | -i Input file containing trace data, or '-' for stdin. | |
61 | -o Output file. If not given, output is stdout. | |
62 | -b stdin read batching. | |
63 | -s Show per-program io statistics. | |
64 | -t Track individual ios. Will tell you the time a request took to | |
65 | get queued, to get dispatched, and to get completed. | |
66 | -q Quiet. Don't display any stats at the end of the trace. | |
67 | -w Only parse data between the given time interval in seconds. If | |
68 | 'start' isn't given, blkparse defaults the start time to 0. | |
69 | -f Output format. Customize the output format. The format field | |
70 | identifiers are: | |
71 | ||
72 | %a - Action | |
73 | %c - CPU ID | |
74 | %C - Task command name | |
75 | %d - Direction (r/w) | |
76 | %D - Device number | |
77 | %e - Error number | |
78 | %M - Major | |
79 | %m - Minor | |
80 | %n - Nblocks | |
81 | %p - PID | |
82 | %P - PDU | |
83 | %s - Sequence number | |
84 | %S - Sector number | |
85 | %t - Time (wallclock - nanoseconds) | |
86 | %T - Time (wallclock - seconds) | |
87 | %u - Time (processing - microseconds) | |
638c1923 | 88 | %U - Unplug depth |
ab197ca7 AB |
89 | |
90 | -F Format specification. The individual specifiers are: | |
91 | ||
92 | B - Back merge | |
93 | C - Complete | |
94 | D - Issue | |
95 | F - Front merge | |
96 | G - Get request | |
b6076a9b | 97 | I - Insert |
ab197ca7 AB |
98 | M - Both front and back merge |
99 | P - Plug | |
100 | Q - Queue | |
101 | R - Requeue | |
102 | S - Sleep requests | |
103 | T - Unplug timer | |
104 | U - Unplug IO | |
93f1c611 JA |
105 | W - Bounce |
106 | X - Split | |
c1bd9d09 | 107 | |
52724a0e | 108 | -v Print program version info. |
c1bd9d09 | 109 | |
d0009925 JA |
110 | If you want to do live tracing, you can pipe the data between blktrace |
111 | and blkparse: | |
112 | ||
113 | % blktrace -d <device> -o - | blkparse -i - | |
114 | ||
115 | This has a small risk of displaying some traces a little out of sync, since | |
116 | it will do batch sorts of input events. Similarly, you can do traces over | |
117 | the network with eg netcat: | |
118 | ||
119 | % blktrace -d /dev/sda -o - | netcat parsehost portno | |
ebc37a0b | 120 | % netcat -l -p portno tracehost | blkparse -i - |
d0009925 JA |
121 | |
122 | Which will send the traces from tracehost to parsehost over the network on | |
123 | the defined port number. | |
124 | ||
125 | ||
8d99d141 JA |
126 | Resources |
127 | --------- | |
128 | ||
129 | vger hosts a mailing list dedicated to btrace discussion and development. | |
130 | The list is called linux-btrace@vger.kernel.org, subscribe by sending | |
131 | a mail to majordomo@vger.kernel.org with 'subscribe linux-btrace' in | |
132 | the mail body. | |
133 | ||
134 | ||
135 | ||
d0009925 | 136 | 20050906, Jens Axboe <axboe@suse.de> |
c1bd9d09 | 137 |