Debian Codegraph @

doc/SystemTap_Beginners_Guide/testsuite/systemtap.bpf/bpf_tests/reg_alloc3.stp

raw
1 global flag = 1
2 global seen
3 probe begin {
4 printf("BEGIN\n")
5 }
6
7 // check whether x, y or z are wrongly overwritten by a reg alloc bug.
8 probe kernel.trace("sched_switch") {
9 x = 1
10 y = 2
11 z = 3
12
13 //printf very verbose over 5s
14 //printf("%d\n", $next_comm[0]);
15 pid = $next_comm[0]
16 if (!seen[pid]) printf("seen %d\n", pid)
17 seen[pid] = 1
18
19 if (x != 1 || y != 2 || z != 3)
20 flag = 0
21 }
22
23 probe timer.s(5) {
24 exit()
25 }
26
27 probe end {
28 if (flag)
29 printf("END PASS\n")
30 else
31 printf("END FAIL\n")
32 }