Debian Codegraph @

doc/SystemTap_Beginners_Guide/testsuite/systemtap.base/tracepoints.stp

raw
1 // This checks that we can compile and register every tracepoint
2 // we can find, along with all of their context variables.
3 global hits
4 probe all_tracepoints = kernel.trace("*")
5 {
6 if ($$name . $$vars . $$parms == "")
7 next
8
9 // Allow it to quit once we hit our hundredth tracepoint
10 if (++hits < 100)
11 next
12 }
13
14 // If there aren't any tracepoints in the kernel,
15 // we use "begin" instead to quit right away.
16 probe all_tracepoints!, begin {
17 // Only print once (after enough hits, or at the begin probe). PR10427
18 if (hits == 0 || hits == 100)
19 println("tracepoints OK")
20 exit()
21 }
22
23 // give hits a use so there's no warning
24 // when we don't have tracepoints
25 probe never { hits++ }