diff options
Diffstat (limited to 'testsuite/semok')
-rwxr-xr-x | testsuite/semok/eleven.stp | 38 | ||||
-rwxr-xr-x | testsuite/semok/ten.stp | 19 |
2 files changed, 50 insertions, 7 deletions
diff --git a/testsuite/semok/eleven.stp b/testsuite/semok/eleven.stp new file mode 100755 index 00000000..bcfa4222 --- /dev/null +++ b/testsuite/semok/eleven.stp @@ -0,0 +1,38 @@ +#! stap -p2 + +global entry_time, my_count, my_fd, read_times + +# future built-ins +function string (v) { return "" } +function hexstring (v) { return "" } +function trace (s) { return 0 } + +probe kernel.syscall("read") { + $count=0 $timestamp=0 $fd=0 + + thread->entry_time = $timestamp # "macro" variable + thread->my_count = $count # function argument + thread->my_fd = $fd # function argument + trace ("my_count = " . string(thread->my_count) . + "my_fd = " . string(thread->my_fd)) +} + +probe kernel.syscall("read").return { + $syscall_name="" $retvalue=0 + + if (thread->entry_time) { + read_times[$syscall_name] # variable from provider alias + += $timestamp - thread->entry_time + } + trace ("syscall " . $syscall_name . + " return value = " . + hexstring ($retvalue)) # function pseudo-argument +} + +probe end { + foreach (syscall in read_times) { + trace ("syscall " . syscall . + " total-time=" . string (read_times[syscall])) + } +} + diff --git a/testsuite/semok/ten.stp b/testsuite/semok/ten.stp index d56c2a4a..bb353a9f 100755 --- a/testsuite/semok/ten.stp +++ b/testsuite/semok/ten.stp @@ -1,10 +1,15 @@ -#! stap -p1 +#! stap -p2 -global a1, a2, a3 +global arr,rra -probe all -{ - a = "1" in a1; - a = ("1", a) in a2; - a = (a, a+a, a1[a], a2[0+a]) in a3; +probe begin { + arr["key"]=0 + rra[0]="value" +} +probe end { + # confirm that typechecking works the same way for all array indexing + if (k in arr) { k.""; arr[k]+0 } + foreach (l in arr) { l.""; arr[l]+0 } + if (m in rra) { m+0; rra[m]."" } + foreach (n in rra) { n+0; rra[n]."" } } |