Debian Codegraph @

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

raw
1 /*
2 * kfunct.stp
3 *
4 * Check the systemtap avoids infinite loops
5 * install it, and get some output.
6 */
7
8 global count
9 global loop_count
10
11 probe begin
12 {
13 println("systemtap starting probe")
14 }
15
16 probe kernel.function("schedule")
17 {
18 ++count;
19 for(a = 1; a <=10; ++a) {
20 ++loop_count;
21 }
22 }
23
24 probe end
25 {
26 println("systemtap ending probe")
27 printf("count = %d\n", count)
28 printf("loop_count = %d\n", loop_count)
29 if ( count * 10 == loop_count) {
30 println("systemtap test success");
31 } else {
32 println("systemtap test failure");
33 }
34 }