Debian Codegraph @

doc/SystemTap_Beginners_Guide/testsuite/systemtap.bpf/bpf_tests/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 }