Skip to content

Instantly share code, notes, and snippets.

@cwen0
Forked from ethercflow/inject_diskio_delay.stp
Created July 2, 2018 07:32
Show Gist options
  • Save cwen0/0ef3deab656d8e32204a5b798601554f to your computer and use it in GitHub Desktop.
Save cwen0/0ef3deab656d8e32204a5b798601554f to your computer and use it in GitHub Desktop.
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