summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/test_ftrace.sh
blob: f5109eb0e951303f793ccfc09e5e2319291fba00 (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
#!/bin/bash

if [[ -e /sys/kernel/tracing/trace ]]; then
    TR=/sys/kernel/tracing/
else
    TR=/sys/kernel/debug/tracing/
fi

clear_trace() { # reset trace output
    echo > $TR/trace
}

disable_tracing() { # stop trace recording
    echo 0 > $TR/tracing_on
}

enable_tracing() { # start trace recording
    echo 1 > $TR/tracing_on
}

reset_tracer() { # reset the current tracer
    echo nop > $TR/current_tracer
}

disable_tracing
clear_trace

echo "" > $TR/set_ftrace_filter
echo '*printk* *console* *wake* *serial* *lock*' > $TR/set_ftrace_notrace

echo "bpf_prog_test*" > $TR/set_graph_function
echo "" > $TR/set_graph_notrace

echo function_graph > $TR/current_tracer

enable_tracing
./test_progs -t fentry
./test_progs -t fexit
disable_tracing
clear_trace

reset_tracer

exit 0