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