1 # SPDX-License-Identifier: GPL-2.0-only
3 clear_trace
() { # reset trace output
7 disable_tracing
() { # stop trace recording
11 enable_tracing
() { # start trace recording
15 reset_tracer
() { # reset the current tracer
16 echo nop
> current_tracer
19 reset_trigger_file
() {
20 # remove action triggers first
21 grep -H ':on[^:]*(' $@ |
23 cmd
=`echo $line | cut -f2- -d: | cut -f1 -d"["`
24 file=`echo $line | cut -f1 -d:`
29 cmd
=`echo $line | cut -f2- -d: | cut -f1 -d"["`
30 file=`echo $line | cut -f1 -d:`
35 reset_trigger
() { # reset all current setting triggers
36 if [ -d events
/synthetic
]; then
37 reset_trigger_file events
/synthetic
/*/trigger
39 reset_trigger_file events
/*/*/trigger
42 reset_events_filter
() { # reset all current setting filters
43 grep -v ^none events
/*/*/filter |
45 echo 0 > `echo $line | cut -f1 -d:`
49 reset_ftrace_filter
() { # reset all triggers in set_ftrace_filter
50 if [ ! -f set_ftrace_filter
]; then
53 echo > set_ftrace_filter
54 grep -v '^#' set_ftrace_filter |
while read t
; do
55 tr=`echo $t | cut -d: -f2`
56 if [ "$tr" = "" ]; then
59 if ! grep -q "$t" set_ftrace_filter
; then
62 name
=`echo $t | cut -d: -f1 | cut -d' ' -f1`
63 if [ $tr = "enable_event" -o $tr = "disable_event" ]; then
64 tr=`echo $t | cut -d: -f2-4`
65 limit
=`echo $t | cut -d: -f5`
67 tr=`echo $t | cut -d: -f2`
68 limit
=`echo $t | cut -d: -f3`
70 if [ "$limit" != "unlimited" ]; then
73 echo "!$name:$tr" > set_ftrace_filter
78 echo 0 > events
/enable
81 clear_synthetic_events
() { # reset all current synthetic events
82 grep -v ^
# synthetic_events |
84 echo "!$line" >> synthetic_events
88 initialize_ftrace
() { # Reset ftrace to initial-state
89 # As the initial state, ftrace will be set to nop tracer,
90 # no events, no triggers, no filters, no function filters,
91 # no probes, and tracing on.
98 [ -f set_event_pid
] && echo > set_event_pid
99 [ -f set_ftrace_pid
] && echo > set_ftrace_pid
100 [ -f set_ftrace_notrace
] && echo > set_ftrace_notrace
101 [ -f set_graph_function
] && echo |
tee set_graph_
*
102 [ -f stack_trace_filter
] && echo > stack_trace_filter
103 [ -f kprobe_events
] && echo > kprobe_events
104 [ -f uprobe_events
] && echo > uprobe_events
105 [ -f synthetic_events
] && echo > synthetic_events
106 [ -f snapshot
] && echo 0 > snapshot