Skip to content

Instantly share code, notes, and snippets.

@harshavardhana
Created October 7, 2014 22:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harshavardhana/23faca6f93bcc946c67c to your computer and use it in GitHub Desktop.
Save harshavardhana/23faca6f93bcc946c67c to your computer and use it in GitHub Desktop.
#!/usr/bin/stap
#
global write_errors, write_success
function handlewrite (pp, ret) {
if (ret < 0)
{
printf("%s %s returned %d", tz_ctime(gettimeofday_s()), pp, ret)
write_errors[pp]++
}
else
{
write_success[pp]++
}
}
probe process("/usr/libexec/qemu-kvm").function("*_writev").return
{
handlewrite(pp(), $return)
}
probe process("/usr/libexec/qemu-kvm").function("qemu_gluster_aio_rw").return
{
if ($write)
handlewrite(pp(), $return)
}
probe process("/usr/lib*/libgfapi.so.*").function("glfs_pwritev_async").return
{
handlewrite(pp(), $return)
}
probe end
{
printf("Write success :\n")
foreach(p in write_success)
{
printf("%s %d\n", p, write_success[p])
}
printf("Write error :\n")
foreach(p in write_errors)
{
printf("%s %d\n", p, write_errors[p])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment