doc/SystemTap_Beginners_Guide/testsuite/systemtap.base/pt_user_mode.stp
raw| 1 | /* |
| 2 | * Check perf/timer trigger in both user/kernel mode. |
| 3 | */ |
| 4 | |
| 5 | global u, k |
| 6 | |
| 7 | probe begin |
| 8 | { |
| 9 | println("systemtap starting probe"); |
| 10 | } |
| 11 | |
| 12 | probe perf.sw.cpu_clock!, timer.profile |
| 13 | { |
| 14 | if (user_mode()) |
| 15 | u <<< 1 |
| 16 | else |
| 17 | k <<< 1 |
| 18 | } |
| 19 | |
| 20 | probe end |
| 21 | { |
| 22 | println("systemtap ending probe") |
| 23 | if (@count(u) == 0 || @count(k) == 0) { |
| 24 | println("systemtap test failure"); |
| 25 | } else { |
| 26 | println("systemtap test success"); |
| 27 | } |
| 28 | } |