BTstats, which stands for Block Trace Stats, is intended to extract high level statistics from the traces taken with the Linux kernel blktrace tool. It is implemented in C and its design goal is to be easily extensible and easy to use.

This tool is inspired in the btt application but, of course, its goal is not to be a replacement. btt is very useful as well and you should probably take a look to it. I created BTstats because is easier for me to use and extend. It also fits very well to the way I use blktrace.


In order to understand better this statistics, it is recommended to take a look to the blktrace documentation. Currently, BTstats already implement a couple of statistics that I use in my research. The following list explain each of them.


Usage: btstats [-h] [-f <file>] [-r <reader>] [-t] [-d <file>] [-i <file>] [<trace> .. <trace>]

	-h: Show this help message and exit
	-f: File which list the traces and phases to analyze.
	-t: Print the total stats for all traces.
	-d: File sufix where all the details of D2C will be stored.
		<timestamp> <Sector #> <Req. Size (blks)> <D2C time (sec)>
	-i: File sufix where all the changes in OIO for I2C are logged.
	-s: File sufix where the histogram of OIO for I2C is printed.
	-r: Trace reader to be used
		0: default
		1: reader for driver ata_piix
	<trace>: String of device/range to analyze. Exclusive with -f.


For all the examples, let us assume the files seq1.blktrace.0 and seq2.blktrace.0 exist corresponding to the blktrace files.


Currently there are two implementations. I started by implementing btstats in python. Unfortunately, it turns out to be quite slow and I decided to re-implement in C which is the code that I now maintain. Below, it is listed the repository of the C code and its requirements. I keep track of versions with the git system.

git clone git://


This version of btstats strongly use glib and gsl libraries. Make sure to have this before trying to compile (Ubuntu: libglib2.0-dev).

Plugin Development

I have not had the time to do a guide for the development of a btstats plugin. I would suggest to start by looking at some simple plugin as is the case of reqsize.