testsuite/systemtap.examples/profiling/syscallsrw.stp
raw| 1 | #! /usr/bin/stap --bpf |
| 2 | |
| 3 | global arr |
| 4 | |
| 5 | probe kernel.function("ksys_read") !, kernel.function("vfs_read") { |
| 6 | arr[0]++; |
| 7 | } |
| 8 | |
| 9 | probe kernel.function("ksys_write") !, kernel.function("vfs_write") { |
| 10 | arr[1]++; |
| 11 | } |
| 12 | |
| 13 | probe prometheus { |
| 14 | |
| 15 | $value .= ("count{syscall=\"ksys_read\"} " . sprint(arr[0]) . "\n") |
| 16 | $value .= ("count{syscall=\"ksys_write\"} " . sprint(arr[1]) . "\n") |
| 17 | |
| 18 | } |