Debian Codegraph @

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

raw
1 // This test assumes that there are 100 jiffies per second.
2 // This assumption will not hold for every kernel (but should
3 // hold for many).
4 global ns, us, ms, s, jf, hz
5 probe begin {
6 printf("BEGIN\n")
7 }
8
9 probe timer.ns(1000000000) {
10 ns++
11 }
12
13 probe timer.us(1000000) {
14 us++
15 }
16
17 probe timer.ms(1000) {
18 ms++
19 }
20
21 probe timer.s(1) {
22 s++
23 }
24
25 probe timer.jiffies(100) {
26 jf++
27 }
28
29 probe timer.hz(1) {
30 hz++
31 }
32
33 probe timer.ms(10500) {
34 exit()
35 }
36
37 probe end {
38 if (ns == 10 && us == 10 && ms == 10 && s == 10 && jf == 10 && hz == 10)
39 printf("END PASS\n")
40 else
41 printf("END FAIL\n")
42 }