doc/SystemTap_Beginners_Guide/testsuite/systemtap.bpf/bpf_tests/raw_tracepoint1.stp
raw| 1 | global flag |
| 2 | |
| 3 | probe begin { |
| 4 | printf("BEGIN\n") |
| 5 | } |
| 6 | |
| 7 | probe kernel.trace("sched:sched_switch") { |
| 8 | // look for the process with pid 0 and name that begins with "swap" |
| 9 | if ($next->comm[0] == 115 && $next->comm[1] == 119 |
| 10 | && $next->comm[2] == 97 && $next->comm[3] == 112 |
| 11 | && $next->pid == 0) |
| 12 | flag = 1 |
| 13 | } |
| 14 | |
| 15 | probe timer.s(5) { |
| 16 | exit() |
| 17 | } |
| 18 | |
| 19 | probe end { |
| 20 | if (flag) |
| 21 | printf("END PASS\n") |
| 22 | else |
| 23 | printf("END FAIL\n") |
| 24 | } |