selftests/ftrace: Reduce trace buffer checking overhead
authorMasami Hiramatsu <mhiramat@kernel.org>
Tue, 23 May 2017 06:04:46 +0000 (15:04 +0900)
committerShuah Khan <shuahkh@osg.samsung.com>
Wed, 7 Jun 2017 16:07:22 +0000 (10:07 -0600)
Current event/toplevel-enable.tc checking the trace
buffer by dumping all events while recording events.
However, this makes system very busy.

To reduce this overhead comes from reading trace buffer
and recording trace buffer, use head instead of cat
and stop tracing while reading.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
tools/testing/selftests/ftrace/test.d/event/toplevel-enable.tc

index 0bb5df3..15e2d3f 100644 (file)
@@ -28,7 +28,9 @@ echo '*:*' > set_event
 
 yield
 
-count=`cat trace | grep -v ^# | wc -l`
+echo 0 > tracing_on
+
+count=`head -n 128 trace | grep -v ^# | wc -l`
 if [ $count -eq 0 ]; then
     fail "none of events are recorded"
 fi
@@ -36,10 +38,12 @@ fi
 do_reset
 
 echo 1 > events/enable
+echo 1 > tracing_on
 
 yield
 
-count=`cat trace | grep -v ^# | wc -l`
+echo 0 > tracing_on
+count=`head -n 128 trace | grep -v ^# | wc -l`
 if [ $count -eq 0 ]; then
     fail "none of events are recorded"
 fi