Message ID | 20210819041842.696873153@goodmis.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | tracing: Creation of event probe | expand |
On Thu, 19 Aug 2021 00:13:30 -0400 Steven Rostedt <rostedt@goodmis.org> wrote: > +clear_dynamic_events() { # reset all current dynamic events > + again=1 > + stop=1 > + # loop mulitple times as some events require other to be removed first > + while [ $again -eq 1 ]; do > + stop=$((stop+1)) > + # Prevent infinite loops > + if [ $stop -gt 10 ]; then > + break; > + fi > + again=2 > + grep -v '^#' dynamic_events| > + while read line; do > + del=`sed -e 's/^.\([^ ]*\).*/-\1/'` That should be "del=`echo $line | sed -e 's/^.\([^ ]*\).*/-\1/'` Will fix in v8. -- Steve > + if ! echo "$del" >> dynamic_events; then > + again=1 > + fi > + done > + done > +}
diff --git a/tools/testing/selftests/ftrace/test.d/functions b/tools/testing/selftests/ftrace/test.d/functions index a6fac927ee82..1e6ae4a243a4 100644 --- a/tools/testing/selftests/ftrace/test.d/functions +++ b/tools/testing/selftests/ftrace/test.d/functions @@ -83,6 +83,27 @@ clear_synthetic_events() { # reset all current synthetic events done } +clear_dynamic_events() { # reset all current dynamic events + again=1 + stop=1 + # loop mulitple times as some events require other to be removed first + while [ $again -eq 1 ]; do + stop=$((stop+1)) + # Prevent infinite loops + if [ $stop -gt 10 ]; then + break; + fi + again=2 + grep -v '^#' dynamic_events| + while read line; do + del=`sed -e 's/^.\([^ ]*\).*/-\1/'` + if ! echo "$del" >> dynamic_events; then + again=1 + fi + done + done +} + initialize_ftrace() { # Reset ftrace to initial-state # As the initial state, ftrace will be set to nop tracer, # no events, no triggers, no filters, no function filters, @@ -93,6 +114,7 @@ initialize_ftrace() { # Reset ftrace to initial-state reset_events_filter reset_ftrace_filter disable_events + clear_dynamic_events [ -f set_event_pid ] && echo > set_event_pid [ -f set_ftrace_pid ] && echo > set_ftrace_pid [ -f set_ftrace_notrace ] && echo > set_ftrace_notrace