| 1 |
# maxactive.exp |
| 2 |
# |
| 3 |
# Check to see if using the 'maxactive(N)' limit on return probes |
| 4 |
# works, by seeing if skipped probes increases when using it. |
| 5 |
|
| 6 |
if {![installtest_p]} { untested "MAXACTIVE"; return } |
| 7 |
|
| 8 |
proc sleep_one_sec {} { |
| 9 |
wait_n_secs 1; |
| 10 |
return 0; |
| 11 |
} |
| 12 |
|
| 13 |
# Script1. For 1 second, probe the return of "vfs_read" and |
| 14 |
# "do_select". See if we skip any probes. |
| 15 |
set script1 { |
| 16 |
global foo |
| 17 |
probe kernel.function("vfs_read").return, |
| 18 |
kernel.function("do_select").return { foo++ } |
| 19 |
|
| 20 |
probe timer.ms(1000) { exit(); } |
| 21 |
probe begin { log("systemtap starting probe") } |
| 22 |
probe end { log("systemtap ending probe"); printf("foo = %d\n", foo) } |
| 23 |
} |
| 24 |
|
| 25 |
# Run script1 and save the number of skipped probes (which will most |
| 26 |
# likely be 0). |
| 27 |
stap_run "MAXACTIVE01" sleep_one_sec {foo = \d+\r\n} -e $script1 |
| 28 |
set skipped1 $skipped_probes |
| 29 |
|
| 30 |
# Script2. For 1 second, probe the return of "vfs_read" and |
| 31 |
# "do_select", with a limit of 1 probe active at a time. See if we |
| 32 |
# skip any probes. |
| 33 |
set script2 { |
| 34 |
global foo |
| 35 |
probe kernel.function("vfs_read").return.maxactive(1), |
| 36 |
kernel.function("do_select").return.maxactive(1) { foo++ } |
| 37 |
|
| 38 |
probe timer.ms(1000) { exit(); } |
| 39 |
probe begin { log("systemtap starting probe") } |
| 40 |
probe end { log("systemtap ending probe"); printf("foo = %d\n", foo) } |
| 41 |
} |
| 42 |
|
| 43 |
# Run script2 and save the number of skipped probes. |
| 44 |
set output_string {foo = \d+\r\n(WARNING: Number of errors: 0, skipped probes: \d+\r\n)?} |
| 45 |
stap_run "MAXACTIVE02" sleep_one_sec $output_string -e $script2 |
| 46 |
set skipped2 $skipped_probes |
| 47 |
|
| 48 |
# If the number of skipped probes for script 1 is less than the number |
| 49 |
# of skipped probes for script 2, we can assume that "maxactive(N)" is |
| 50 |
# working. |
| 51 |
# |
| 52 |
# Note that this isn't 100% accurate based on the system load at the |
| 53 |
# time of the scripts. |
| 54 |
set test "MAXACTIVE03" |
| 55 |
verbose -log "skipped1: $skipped1, skipped2: $skipped2\n" |
| 56 |
if {$skipped1 <= $skipped2} { |
| 57 |
pass $test |
| 58 |
} else { |
| 59 |
fail "$test ($skipped1 skipped probes > $skipped2 skipped probes)" |
| 60 |
} |