HOWTO collect a block trace under linux
Introduction
These instructions have been tested on the following distributions:
And were tested using blktrace version 1.0.1
Please let support@fusionio.com know if you have tested this on any other
distributions, as well as what modifications, if any, were needed.
Prerequisites
You will need a 2.6.17 kernel, or greater.
Installation
If not already available for your distribution, download blktrace from:
http://brick.kernel.dk/snaps/
Setup/Running
- Ensure that debugfs is mounted on /sys/kernel/debug.
$ grep debug /proc/mounts
If debugfs is mounted, you should see:
none /sys/kernel/debug debugfs rw 0 0
If not mounted, mount it.
$ mount -t debugfs none /sys/kernel/debug
- Capture a 10 minute trace.
$ ./blktrace -d /dev/fioa -w 600
=== fioa ===
CPU 0: 0 events, 0 KiB data
CPU 1: 1205 events, 57 KiB data
CPU 2: 106 events, 5 KiB data
CPU 3: 0 events, 0 KiB data
CPU 4: 573397 events, 26878 KiB data
CPU 5: 7059 events, 331 KiB data
CPU 6: 4956 events, 233 KiB data
CPU 7: 21903 events, 1027 KiB data
Total: 608626 events (dropped 0), 28530 KiB data
The output is stored in several files, one per CPU core, and named after the
device traced:
$ ls -al fioa*
-rw-r--r-- 1 root root 0 Jul 8 10:01 fioa.blktrace.0
-rw-r--r-- 1 root root 57856 Jul 8 10:01 fioa.blktrace.1
-rw-r--r-- 1 root root 5088 Jul 8 10:01 fioa.blktrace.2
-rw-r--r-- 1 root root 0 Jul 8 10:01 fioa.blktrace.3
-rw-r--r-- 1 root root 27523072 Jul 8 10:01 fioa.blktrace.4
-rw-r--r-- 1 root root 338856 Jul 8 10:01 fioa.blktrace.5
-rw-r--r-- 1 root root 237920 Jul 8 10:01 fioa.blktrace.6
-rw-r--r-- 1 root root 1051352 Jul 8 10:01 fioa.blktrace.7
Please contact support@fusionio.com for a location to upload a tarball of
your tracefiles to for analysis.
Replay capture with fio ( http://freshmeat.net/projects/fio )
- Convert the multiple blktrace captures to a fio compatable input file.
$ ./blkparse fioa -d trace_input_for_fio -o /dev/null
- Reference the trace file in the fio job by adding something similar to the
following into the fio job file:
read_iolog=trace_input_for_fio