| 1 |
global switch=-1 |
| 2 |
|
| 3 |
#begin probe |
| 4 |
probe begin if (switch==-1) { |
| 5 |
printf("begin1 probed: %s\n", module_name()); |
| 6 |
} |
| 7 |
|
| 8 |
probe begin if (switch==0) { |
| 9 |
log("begin2 probed"); |
| 10 |
} |
| 11 |
|
| 12 |
#dwarf probe (return) |
| 13 |
# |
| 14 |
# Note that we were originally probing |
| 15 |
# kernel.function("vfs_write").return here. However, on some kernels |
| 16 |
# (like 3.10.0-327.el7.ppc64), vfs_write() could be inlined, so we'd |
| 17 |
# miss the return. |
| 18 |
probe syscall.write.return if (switch == 1) { |
| 19 |
log("function return probed") |
| 20 |
switch = 0 |
| 21 |
} |
| 22 |
|
| 23 |
#dwarf probe (entry) |
| 24 |
probe syscall.write if (switch == 2) { |
| 25 |
log("function entry probed") |
| 26 |
switch = 0 |
| 27 |
} |
| 28 |
|
| 29 |
#timer probe |
| 30 |
probe timer.ms(100) if (switch == 3) { |
| 31 |
log("timer probed") |
| 32 |
switch = 0 |
| 33 |
} |
| 34 |
|
| 35 |
#profile probe |
| 36 |
probe timer.profile if (switch == 4) { |
| 37 |
log("profile probed") |
| 38 |
switch = 0 |
| 39 |
} |
| 40 |
|
| 41 |
# aliasess |
| 42 |
probe alias.one.a = timer.ms(150) if (switch == 5) { print("alias.one.a and") } |
| 43 |
probe alias.one.b = timer.ms(200) if (switch == 6) { print("alias.one.b and") } |
| 44 |
probe alias.one = alias.one.* if (switch >= 5 && switch < 7) { print(" alias.one and") } |
| 45 |
probe alias.two = timer.ms(250) if (switch == 7) { print("alias.two and") } |
| 46 |
probe alias.* if (switch) { log(" alias.* probed") } |
| 47 |
|
| 48 |
probe procfs("switch").write { |
| 49 |
switch = strtol($value, 10) |
| 50 |
if (switch > 7) { |
| 51 |
exit() |
| 52 |
} |
| 53 |
} |
| 54 |
|