doc/SystemTap_Beginners_Guide/testsuite/systemtap.base/stable_function_mix.stp
raw| 1 | // stable_function_mix.stp - normal function and embedded-c function |
| 2 | // including nested functioncalls |
| 3 | |
| 4 | %{int f1hits = 0; %} |
| 5 | global fn3_hits |
| 6 | |
| 7 | function fn1:long() %{ |
| 8 | /* pure */ /* stable */ |
| 9 | f1hits++; |
| 10 | STAP_RETURN(100); |
| 11 | %} |
| 12 | |
| 13 | function fn2:long(x) %{ |
| 14 | STAP_RETURN(STAP_ARG_x); |
| 15 | %} |
| 16 | |
| 17 | function fn3:long() { |
| 18 | fn3_hits++ |
| 19 | x = fn1() |
| 20 | y = fn1() |
| 21 | if (x == y) { |
| 22 | z = fn1() |
| 23 | } |
| 24 | return x+y+z |
| 25 | } |
| 26 | |
| 27 | probe begin { |
| 28 | x = fn1() |
| 29 | x = fn3() |
| 30 | println(x, " ", fn3(), " ", fn2(fn1()), " ", %{f1hits%}, " ", fn3_hits) |
| 31 | exit() |
| 32 | } |