-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1794 from utam0k/bpftrace
Add the bpftrace program file for debugging.
- Loading branch information
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env bpftrace | ||
|
||
BEGIN | ||
{ | ||
printf("Tracing Youki syscalls... Hit Ctrl-C to end.\n"); | ||
printf("%-12s %-10s %-8s %-9s %s\n", "TIME", "COMMAND", "PID", "EVENT", "CONTENT"); | ||
} | ||
|
||
tracepoint:syscalls:sys_enter_write | ||
/comm == "4"|| comm == "youki*"/ | ||
{ | ||
|
||
$s = str(args->buf, args->count); | ||
if ($s != "\n") { | ||
printf("%-12ld %-10s %-8d %-9s ", elapsed , comm, pid, "write"); | ||
printf("fd=%d, %s\n", args->fd, $s); | ||
} | ||
} | ||
|
||
tracepoint:syscalls:sys_enter_open, | ||
tracepoint:syscalls:sys_enter_openat | ||
/comm == "4"|| comm == "youki"/ | ||
{ | ||
@filename[tid] = args->filename; | ||
} | ||
|
||
|
||
tracepoint:syscalls:sys_exit_open, | ||
tracepoint:syscalls:sys_exit_openat | ||
/@filename[tid]/ | ||
{ | ||
$ret = args->ret; | ||
$fd = $ret >= 0 ? $ret : -1; | ||
$errno = $ret >= 0 ? 0 : - $ret; | ||
|
||
printf("%-12ld %-10s %-8d %-9s ", elapsed , comm, pid, "open"); | ||
printf("errno=%d, fd=%d, file=%s\n", $errno, $fd, str(@filename[tid])); | ||
delete(@filename[tid]); | ||
} | ||
|
||
tracepoint:syscalls:sys_enter_clone3 | ||
/comm == "4"|| comm == "youki"/ | ||
{ | ||
printf("%-12ld %-10s %-8d %-9s ", elapsed , comm, pid, "clone3"); | ||
} | ||
|
||
END | ||
{ | ||
clear(@filename); | ||
printf("Tracing ended.\n"); | ||
} | ||
|