Created
May 24, 2018 16:43
-
-
Save ethercflow/4a98abc3f97ff44608e3fda99d178be1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global inject, delay_cnt | |
probe begin { | |
println("injdect diskio delay begin.\n"); | |
} | |
probe procfs("cnt").read { | |
$value = sprintf("%d\n", delay_cnt); | |
} | |
probe procfs("inject").write { | |
inject = $value; | |
printf("inject count %d, delay_cnt %s", delay_cnt, inject); | |
} | |
probe vfs.read.return { | |
if ($return && devname == @1 && inject == "on\n") { | |
delay_cnt++; | |
udelay($2); | |
} | |
} | |
probe vfs.write.return { | |
if ($return && devname == @1 && inject == "on\n") { | |
delay_cnt++; | |
udelay($3); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
eg:
sudo stap -p4 -DMAXSKIPPED=9999 -m idd -g inject_diskio_delay.stp sda6 300
sudo staprun idd.ko
echo on|sudo tee /proc/systemtap/idd/inject && sleep 60 && echo off|sudo tee /proc/systemtap/idd/inject