selftests/ftrace: Add ringbuffer size changing testcase
authorMasami Hiramatsu <mhiramat@kernel.org>
Thu, 30 Aug 2018 14:21:53 +0000 (23:21 +0900)
committerShuah Khan (Samsung OSG) <shuah@kernel.org>
Wed, 24 Oct 2018 20:49:36 +0000 (14:49 -0600)
Add a testcase for changing ringbuffer size. This tests
not only ringbuffer size but also tests the imbalance
per-cpu buffer size change too.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
tools/testing/selftests/ftrace/test.d/00basic/ringbuffer_size.tc [new file with mode: 0644]

diff --git a/tools/testing/selftests/ftrace/test.d/00basic/ringbuffer_size.tc b/tools/testing/selftests/ftrace/test.d/00basic/ringbuffer_size.tc
new file mode 100644 (file)
index 0000000..ab70f00
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+# description: Change the ringbuffer size
+# flags: instance
+
+rb_size_test() {
+ORIG=`cat buffer_size_kb`
+
+expr $ORIG / 2 > buffer_size_kb
+
+expr $ORIG \* 2 > buffer_size_kb
+
+echo $ORIG > buffer_size_kb
+}
+
+rb_size_test
+
+: "If per-cpu buffer is supported, imbalance it"
+if [ -d per_cpu/cpu0 ]; then
+  cd per_cpu/cpu0
+  rb_size_test
+fi