summaryrefslogtreecommitdiff
path: root/systemtap/ioblock_delay
diff options
context:
space:
mode:
authoryvesf <yvesf-git@xapek.org>2011-09-04 17:59:46 +0200
committeryvesf <yvesf-git@xapek.org>2011-09-04 17:59:46 +0200
commitfaf64a10d51ca7e808cdaf74cba8c31e1d61d6d6 (patch)
treea9996e5df878bb21f707e62d7e5137dbcc701587 /systemtap/ioblock_delay
parent6ba7fa0dba08d1b91cf42a8a797b7f5ad44ec217 (diff)
downloadscripts-faf64a10d51ca7e808cdaf74cba8c31e1d61d6d6.tar.gz
scripts-faf64a10d51ca7e808cdaf74cba8c31e1d61d6d6.zip
system iodelay (nur mit usbstick getestet)
Diffstat (limited to 'systemtap/ioblock_delay')
-rwxr-xr-xsystemtap/ioblock_delay/device.sh5
-rwxr-xr-xsystemtap/ioblock_delay/device.stp31
2 files changed, 36 insertions, 0 deletions
diff --git a/systemtap/ioblock_delay/device.sh b/systemtap/ioblock_delay/device.sh
new file mode 100755
index 0000000..1bb5ba3
--- /dev/null
+++ b/systemtap/ioblock_delay/device.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+test -e "/dev/$1" || { echo "USAGE: $0 <devicename without prefix>"; exit 1; }
+
+stap -c "dd if=\"/dev/$1\" of=/dev/null bs=1M" device.stp "$1"
diff --git a/systemtap/ioblock_delay/device.stp b/systemtap/ioblock_delay/device.stp
new file mode 100755
index 0000000..b9270e5
--- /dev/null
+++ b/systemtap/ioblock_delay/device.stp
@@ -0,0 +1,31 @@
+// size of array equals to max. number of pending requests
+global calls[30000];
+
+probe begin {
+ printf("device,sector,time_ns\n");
+}
+
+probe ioblock.request
+{
+ if (devname == @1) {
+ calls[$bio] = gettimeofday_ns();
+ }
+}
+
+probe ioblock.end
+{
+ if ([$bio] in calls) {
+ time = gettimeofday_ns() - calls[$bio];
+ delete calls[$bio];
+
+ printf("%s,%u,%ld\n",
+ devname, sector, time);
+ }
+}
+
+probe end {
+ foreach ([bio] in calls) {
+ printf("# Lost: %s,%u,%u\n",
+ __bio_devname(bio), @cast(bio, "bio")->bi_sector, calls[bio]);
+ }
+}