Debian Codegraph @

doc/SystemTap_Beginners_Guide/testsuite/systemtap.bpf/bpf_tests/timer2.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, jf
5 probe begin {
6 printf("BEGIN\n")
7 }
8
9 probe timer.ns(5000000) {
10 ns++
11 }
12
13 probe timer.us(5000) {
14 us++
15 }
16
17 probe timer.ms(5) {
18 ms++
19 }
20
21 probe timer.jiffies(1) {
22 jf++
23 }
24
25 probe timer.ms(1000) {
26 exit()
27 }
28
29 probe end {
30 printf("%d %d %d\n", ns, us, ms)
31 printf("%d\n", jf)
32 if (ns == 200 && us == 200 && ms == 200 && jf == 99)
33 printf("END PASS\n")
34 else
35 printf("END FAIL\n")
36 }