aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/testing/selftests/ftrace
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@kernel.org>2018-08-30 23:22:21 +0900
committerShuah Khan (Samsung OSG) <shuah@kernel.org>2018-10-24 14:49:36 -0600
commit5b56a07b9c461bb4db26797c82d6ac3be0f83a94 (patch)
treef68e1870c7f00ef808eddcee7daf032ad20fea92 /tools/testing/selftests/ftrace
parentselftests/ftrace: Add ringbuffer size changing testcase (diff)
downloadwireguard-linux-5b56a07b9c461bb4db26797c82d6ac3be0f83a94.tar.xz
wireguard-linux-5b56a07b9c461bb4db26797c82d6ac3be0f83a94.zip
selftests/ftrace: Add function profiling stat testcase
Add a testcase for function profiling per-cpu statistics interface. There is already func_profile.tc, but that is mainly focusing on the combination of function-profiler and function tracer. This testcase ensures trace_stat per-cpu function statistics is correctly updated. 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>
Diffstat (limited to 'tools/testing/selftests/ftrace')
-rw-r--r--tools/testing/selftests/ftrace/test.d/ftrace/func_profile_stat.tc22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func_profile_stat.tc b/tools/testing/selftests/ftrace/test.d/ftrace/func_profile_stat.tc
new file mode 100644
index 000000000000..0d501058aa75
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_profile_stat.tc
@@ -0,0 +1,22 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+# description: ftrace - function profiling
+
+[ ! -f function_profile_enabled ] && exit_unsupported
+
+: "Enable function profile"
+echo 1 > function_profile_enabled
+
+: "Profile must be updated"
+cp trace_stat/function0 $TMPDIR/
+( echo "forked"; sleep 1 )
+: "diff returns 0 if there is no difference"
+! diff trace_stat/function0 $TMPDIR/function0
+
+echo 0 > function_profile_enabled
+
+: "Profile must NOT be updated"
+cp trace_stat/function0 $TMPDIR/
+( echo "forked"; sleep 1 )
+: "diff returns 0 if there is no difference"
+diff trace_stat/function0 $TMPDIR/function0