File: all_kernel_functions.exp

package info (click to toggle)
systemtap 2.6-0.2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 21,220 kB
  • ctags: 10,944
  • sloc: cpp: 53,239; ansic: 50,615; exp: 33,694; sh: 9,906; xml: 7,665; perl: 2,089; python: 1,534; tcl: 1,236; makefile: 797; java: 148; lisp: 104; awk: 94; asm: 91; sed: 16
file content (55 lines) | stat: -rw-r--r-- 1,759 bytes parent folder | download
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
proc genload {} {
    # if 'genload' from the ltp exists, use it to create a real load
    set genload {/usr/local/ltp/testcases/bin/genload}
    if [file executable $genload] {
        exec $genload -c 10 -i 10 -m 10 -t 10
        #                               ^^^^^ run for 10 seconds
        #                         ^^^^^ 10 procs spinning on malloc
        #                   ^^^^^ 10 procs spinning on sync
        #             ^^^^^ 10 procs spinning on sqrt
    } else {
        # sleep for a bit
        wait_n_secs 10
    }
    return 0
}

proc probe_ok {probepoint} {
    set cmd {exec stap -p2 -e}
    lappend cmd "probe $probepoint {}"
    return [expr ![catch $cmd]]
}

set systemtap_script {
    global stat
    probe %s {
        stat[probefunc()] <<< 1
    }
    probe begin { log ("systemtap starting probe") }
    probe end {
        log ("systemtap ending probe")
        foreach (func in stat limit 5) # don't overflow expect buffer
            printf("%%d  %%s\n", @count(stat[func]), func)
    }
}

set letters [split {abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ} {}]

set output_string "(\\d+  \\w+\\r\\n)*(WARNING.*skipped.*)?"

# Because this test is known to expose system crashes, it is not enabled
# by default.  Change the line below to 'if 1' to enable it.
if 0 {
    foreach start $letters {
        set probepoint "kernel.function(\"$start*\")"
        set prefix "all_kernel_functions:"
        if [probe_ok $probepoint] {
            set script [format $systemtap_script $probepoint]
            stap_run $prefix$probepoint genload $output_string -e $script
        } else {
            unsupported "$prefix no match for $probepoint"
        }
    }
} else {
    untested "all_kernel_functions is disabled"
}