Last active
November 8, 2017 03:14
-
-
Save siddontang/15021aeccb19210567dc09a7f1d185af to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#! /usr/bin/evn stap | |
# | |
probe begin | |
{ | |
printf("begin to trace thread IO"); | |
} | |
probe vfs.read | |
{ | |
if (target() == pid()) { | |
printf("%s[%ld] - read %d from %s\n", execname(), tid(), bytes_to_read, reverse_path_walk($file->f_path->dentry)) | |
} | |
} | |
probe vfs.write | |
{ | |
if (target() == pid()) | |
{ | |
printf("%s[%ld] - write %d to %s\n", execname(), tid(), bytes_to_write, reverse_path_walk($file->f_path->dentry)) | |
} | |
} | |
probe vfs.open | |
{ | |
if (target() == pid()) | |
{ | |
printf("%s[%ld] - open %s\n", execname(), tid(), pathname) | |
} | |
} | |
probe syscall.close | |
{ | |
if (target() == pid()) | |
{ | |
file = task_fd_lookup(task_current(), fd) | |
printf("%s[%ld] - close %s\n", execname(), tid(), fullpath_struct_path(&@cast(file, "file")->f_path)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment