blob: e131fafbee1f7f6b6b1b7e64fb6f99cdf4e66f32 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# Test cases for probefunc() function
proc grep {fd re } {
while {[gets $fd s] >= 0} {
if [regexp $re $s] {
return $s
}
}
}
proc sleep_one_sec {} {
after 1000;
return 0;
}
set systemtap_script {
global funcname
probe %s {
funcname = probefunc()
}
probe begin {
log("systemtap starting probe")
}
probe end {
log("systemtap ending probe")
printf("%%s\n", funcname)
}
}
# open /proc/kallsyms to get address for scheduler_tick symbol
set symf "/proc/kallsyms"
set symfd [open $symf r]
set re "\\mscheduler_tick\\M"
set rs [grep $symfd $re]
set flds [split $rs " "]
set addr [lindex $flds 0]
close $symfd
set prefix "probefunc:"
# test probefunc() with kernel.statement().absolute
set output_string "\\mscheduler_tick\\M\r\n"
set probepoint "kernel.statement(0x$addr).absolute"
set script [format $systemtap_script $probepoint]
stap_run $prefix$probepoint sleep_one_sec $output_string -g -e $script
# test probefunc() with kernel.function()
set probepoint "kernel.function(\"scheduler_tick\")"
set script [format $systemtap_script $probepoint]
stap_run $prefix$probepoint sleep_one_sec $output_string -e $script
# test probefunc() with kernel.inline()
set output_string "\\mcontext_switch\\M\r\n"
set probepoint "kernel.inline(\"context_switch\")"
set script [format $systemtap_script $probepoint]
stap_run $prefix$probepoint sleep_one_sec $output_string -e $script
|