aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-filter.tc
blob: 6af5f6360b184c32bdee9f8c4d40327909e839c7 (plain) (blame)
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
#!/bin/sh
# description: ftrace - function graph filters

# Make sure that function graph filtering works

if ! grep -q function_graph available_tracers; then
    echo "no function graph tracer configured"
    exit_unsupported
fi

do_reset() {
    reset_tracer
    enable_tracing
    clear_trace
}

fail() { # msg
    do_reset
    echo $1
    exit -1
}

disable_tracing
clear_trace

# filter something, schedule is always good
if ! echo "schedule" > set_ftrace_filter; then
    # test for powerpc 64
    if ! echo ".schedule" > set_ftrace_filter; then
	fail "can not enable schedule filter"
    fi
fi

echo function_graph > current_tracer
enable_tracing
sleep 1
# search for functions (has "()" on the line), and make sure
# that only the schedule function was found
count=`cat trace | grep '()' | grep -v schedule | wc -l`
if [ $count -ne 0 ]; then
    fail "Graph filtering not working by itself?"
fi

# Make sure we did find something
count=`cat trace | grep 'schedule()' | wc -l` 
if [ $count -eq 0 ]; then
    fail "No schedule traces found?"
fi

do_reset

exit 0