Diskstat - simple tool to study io patterns via relayfs bert hubert - Netherlabs Computer Consulting BV bert.hubert@netherlabs.nl / http://netherlabs.nl / http://ds9a.nl/diskstat RELEASE NOTES ------------- Version 0.1 - 'Geeks In Black Thorn' Released 23rd of July 2005, Ottawa. The quality of this code is abysmal, for which I squarely blame the fun people at OLS who've been keeping me from my code! This release is so you can see a bit of how I made the graphs in my presentation on http://ds9a.nl/diskstat - it is not an indication of how things will be. The next version will be based on k/jprobes, and will make better use of relayfs features. This also means you won't have to patch your kernel anymore, as long as you compiled with kprobes support. TODO ---- Doesn't output writes - replace 'W' by 'R' in dswalk.cc to look at writes Uses snprintf in kernel, which is slow Makes bad use of relayfs, relayfs offers much better facilities diskstat tools -------------- 1) Get linux-2.6.13-rc3-mm1, with relayfs. Then apply diskstat-patch-against-linux-2.6.13-rc3-mm1 and compile WARNING: eats 10 megabytes of unswappable memory (I think) The patch will probably apply to most of 2.6, but make sure you patch in relayfs. 2) Reboot. 3) Dump your stats # mkdir /relay # mount -t relayfs none /relay # ./dumpdiskstat /relay/diskstat0 > dump This will output something like: I think we skipped at 90867, ret=0 I think we hit end at 143016, ret=-1 I think we hit the break again 90867, ret=0 4) Process the stats. $ ./dswalk < dump It will print out huge latencies encountered: Large latency 163.352 on line 14146 Total read started: 33888768, total ended: 33888768 Total write started: 1372160, total ended: 1372160 Waiting time: 10.695 seconds 5) Make pretty plots gnuplot plot 'startplaces.dat', 'headplaces.dat' plot 'inflight.dat' The generated .dat files are: startplaces.dat: msecs since start of dump / start of read block io request headplaces.dat: msecs since start of dump / end of read block io request latency.dat: dump of all single-request latencies seen, in ms inflight.dat: msecs since start of dump / number of requests in flight