diff mbox series

[v2,23/32] selftests/ftrace: Add function profiling stat testcase

Message ID 153443760252.23257.5752638886588410084.stgit@devbox (mailing list archive)
State Superseded
Headers show
Series selftests/ftrace: Improve ftracetest with coverage check | expand

Commit Message

Masami Hiramatsu (Google) Aug. 16, 2018, 4:40 p.m. UTC
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>
---
 .../ftrace/test.d/ftrace/func_profile_stat.tc      |   23 ++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 tools/testing/selftests/ftrace/test.d/ftrace/func_profile_stat.tc

Comments

Steven Rostedt Aug. 24, 2018, 11:20 p.m. UTC | #1
On Fri, 17 Aug 2018 01:40:02 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:

> 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>
> ---
>  .../ftrace/test.d/ftrace/func_profile_stat.tc      |   23 ++++++++++++++++++++
>  1 file changed, 23 insertions(+)
>  create mode 100644 tools/testing/selftests/ftrace/test.d/ftrace/func_profile_stat.tc
> 
> 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..1d2440d80ec3
> --- /dev/null
> +++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_profile_stat.tc
> @@ -0,0 +1,23 @@
> +#!/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

> +

Can remove the last empty line from the file.

Other than that...

Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

-- Steve

-- Steve
Masami Hiramatsu (Google) Aug. 26, 2018, 11:20 a.m. UTC | #2
On Fri, 24 Aug 2018 19:20:18 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Fri, 17 Aug 2018 01:40:02 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
> 
> > 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>
> > ---
> >  .../ftrace/test.d/ftrace/func_profile_stat.tc      |   23 ++++++++++++++++++++
> >  1 file changed, 23 insertions(+)
> >  create mode 100644 tools/testing/selftests/ftrace/test.d/ftrace/func_profile_stat.tc
> > 
> > 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..1d2440d80ec3
> > --- /dev/null
> > +++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_profile_stat.tc
> > @@ -0,0 +1,23 @@
> > +#!/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
> 
> > +
> 
> Can remove the last empty line from the file.

Yes, thank you for pointing it out.

> 
> Other than that...
> 
> Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

Thanks!

> 
> -- Steve
> 
> -- Steve
diff mbox series

Patch

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..1d2440d80ec3
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_profile_stat.tc
@@ -0,0 +1,23 @@ 
+#!/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
+