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