1#!/bin/bash
2
3if [[ -e /sys/kernel/tracing/trace ]]; then
4    TR=/sys/kernel/tracing/
5else
6    TR=/sys/kernel/debug/tracing/
7fi
8
9clear_trace() { # reset trace output
10    echo > $TR/trace
11}
12
13disable_tracing() { # stop trace recording
14    echo 0 > $TR/tracing_on
15}
16
17enable_tracing() { # start trace recording
18    echo 1 > $TR/tracing_on
19}
20
21reset_tracer() { # reset the current tracer
22    echo nop > $TR/current_tracer
23}
24
25disable_tracing
26clear_trace
27
28echo "" > $TR/set_ftrace_filter
29echo '*printk* *console* *wake* *serial* *lock*' > $TR/set_ftrace_notrace
30
31echo "bpf_prog_test*" > $TR/set_graph_function
32echo "" > $TR/set_graph_notrace
33
34echo function_graph > $TR/current_tracer
35
36enable_tracing
37./test_progs -t fentry
38./test_progs -t fexit
39disable_tracing
40clear_trace
41
42reset_tracer
43
44exit 0
45