diff options
author | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2018-05-14 23:03:58 +0300 |
---|---|---|
committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2018-05-29 15:29:46 +0300 |
commit | 922a418d687b98542736e4f7c6e63a098521b1b6 (patch) | |
tree | 59563cf2656196f852fecc0313a122ad4ff6efed /tools/testing | |
parent | 756b56a9e832e063edc83be7c3889e98c536dd2b (diff) | |
download | linux-922a418d687b98542736e4f7c6e63a098521b1b6.tar.xz |
ftrace/selftest: Fix reset_trigger() to handle triggers with filters
The reset_trigger() function breaks up the command by a space ' '. This is
useful to ignore the '[active]' word for triggers when removing them. But if
the trigger has a filter (ie. "if prio < 10") then the filter needs to be
attached to the line that is written into the trigger file to remove it. But
the truncation removes the filter and the triggers are not cleared properly.
Before, reset_trigger() did this:
# echo 'hist:keys=common_pid if prev_prio < 10' > events/sched/sched_switch/trigger
# echo 'hist:keys=common_pid if next_prio < 10' >> events/sched/sched_switch/trigger
# cat events/sched/sched_switch/trigger
hist:keys=common_pid:vals=hitcount:sort=hitcount:size=2048 if prev_prio < 10 [active]
hist:keys=common_pid:vals=hitcount:sort=hitcount:size=2048 if next_prio < 10 [active]
reset_trigger() {
echo '!hist:keys=common_pid:vals=hitcount:sort=hitcount:size=2048' >> events/sched/sched_switch/trigger
}
# cat events/sched/sched_switch/trigger
hist:keys=common_pid:vals=hitcount:sort=hitcount:size=2048 if prev_prio < 10 [active]
hist:keys=common_pid:vals=hitcount:sort=hitcount:size=2048 if next_prio < 10 [active]
After, where it includes the filter:
reset_trigger() {
echo '!hist:keys=common_pid:vals=hitcount:sort=hitcount:size=2048 if prev_prio < 10' >> events/sched/sched_switch/trigger
}
# cat events/sched/sched_switch/trigger
hist:keys=common_pid:vals=hitcount:sort=hitcount:size=2048 if next_prio < 10 [active]
Fixes: cfa0963dc474f ("kselftests/ftrace : Add event trigger testcases")
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'tools/testing')
-rw-r--r-- | tools/testing/selftests/ftrace/test.d/functions | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/ftrace/test.d/functions b/tools/testing/selftests/ftrace/test.d/functions index 8393b1c06027..e4645d5e3126 100644 --- a/tools/testing/selftests/ftrace/test.d/functions +++ b/tools/testing/selftests/ftrace/test.d/functions @@ -19,13 +19,13 @@ reset_trigger_file() { # remove action triggers first grep -H ':on[^:]*(' $@ | while read line; do - cmd=`echo $line | cut -f2- -d: | cut -f1 -d" "` + cmd=`echo $line | cut -f2- -d: | cut -f1 -d"["` file=`echo $line | cut -f1 -d:` echo "!$cmd" >> $file done grep -Hv ^# $@ | while read line; do - cmd=`echo $line | cut -f2- -d: | cut -f1 -d" "` + cmd=`echo $line | cut -f2- -d: | cut -f1 -d"["` file=`echo $line | cut -f1 -d:` echo "!$cmd" > $file done |