linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Tom Zanussi <tom.zanussi@linux.intel.com>,
	Clark Williams <williams@redhat.com>,
	Karim Yaghmour <karim.yaghmour@opersys.com>,
	Brendan Gregg <bgregg@netflix.com>,
	Joel Fernandes <joel@joelfernandes.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Yann Ylavic <ylavic.dev@gmail.com>,
	linux-rt-users@vger.kernel.org
Subject: Re: [PATCH v2 13/14] tracing/selftest: Add selftests to test trace_marker histogram triggers
Date: Wed, 16 May 2018 22:07:16 +0900	[thread overview]
Message-ID: <20180516220716.60174e9edd8d9f970fcd37e1@kernel.org> (raw)
In-Reply-To: <20180514205959.230719465@goodmis.org>

On Mon, 14 May 2018 16:58:58 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> 
> Add a couple of tests that test the trace_marker histogram triggers.
> One does a straight histogram test, the other will create a synthetic event
> and test the latency between two different writes (using filters to
> differentiate between them).
> 
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> ---
>  .../trigger/trigger-trace-marker-synthetic.tc | 66 +++++++++++++++++++
>  .../test.d/trigger/trigger-trace-marker.tc    | 49 ++++++++++++++
>  2 files changed, 115 insertions(+)
>  create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic.tc
>  create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker.tc
> 
> diff --git a/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic.tc b/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic.tc
> new file mode 100644
> index 000000000000..8e7a043da7fb
> --- /dev/null
> +++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic.tc

OK, since the synthetic event may need histogram support, so this testname is OK.


> @@ -0,0 +1,66 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0
> +# description: event trigger - test histogram with synthetic event
> +# flags:
> +
> +do_reset() {
> +    reset_trigger
> +    echo > set_event
> +    echo > synthetic_events
> +    clear_trace
> +}
> +
> +fail() { #msg
> +    do_reset
> +    echo $1
> +    exit_fail
> +}
> +
> +if [ ! -f set_event ]; then
> +    echo "event tracing is not supported"
> +    exit_unsupported
> +fi
> +
> +if [ ! -f synthetic_events ]; then
> +    echo "synthetic events not supported"
> +    exit_unsupported
> +fi
> +
> +if [ ! -d events/ftrace/print ]; then
> +    echo "event trace_marker is not supported"
> +    exit_unsupported
> +fi
> +
> +if [ ! -f events/ftrace/print/trigger ]; then
> +    echo "event trigger is not supported"
> +    exit_unsupported
> +fi
> +
> +if [ ! -f events/ftrace/print/hist ]; then
> +    echo "hist trigger is not supported"
> +    exit_unsupported
> +fi
> +
> +do_reset
> +
> +echo "Test histogram trace_marker to trace_marker latency histogram trigger"
> +
> +echo 'latency u64 lat' > synthetic_events
> +echo 'hist:keys=common_pid:ts0=common_timestamp.usecs if buf == "start"' > events/ftrace/print/trigger
> +echo 'hist:keys=common_pid:lat=common_timestamp.usecs-$ts0:onmatch(ftrace.print).latency($lat) if buf == "end"' >> events/ftrace/print/trigger
> +echo 'hist:keys=common_pid,lat:sort=lat' > events/synthetic/latency/trigger
> +echo -n "start" > trace_marker
> +echo -n "end" > trace_marker

Ah, this is a great example how we can use this combination :D

> +
> +cnt=`grep 'hitcount: *1$' events/ftrace/print/hist | wc -l`
> +
> +if [ $cnt -ne 2 ]; then
> +    fail "hist trace_marker trigger did not trigger correctly"
> +fi
> +
> +grep 'hitcount: *1$' events/synthetic/latency/hist > /dev/null || \
> +    fail "hist trigger did not trigger "
> +
> +do_reset
> +
> +exit 0
> diff --git a/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker.tc b/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker.tc
> new file mode 100644
> index 000000000000..48e7ac1ccbc1
> --- /dev/null
> +++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker.tc

But this test actually kicks histogram, maybe trigger-trace-marker-hist.tc will be better, since we may need to add a simpler testcase just for checking whether trace-marker works with some actions (e.g. enable/disable other events).

Thank you,

> @@ -0,0 +1,49 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0
> +# description: event trigger - test histogram trigger
> +# flags: instance
> +
> +do_reset() {
> +    reset_trigger
> +    echo > set_event
> +    clear_trace
> +}
> +
> +fail() { #msg
> +    do_reset
> +    echo $1
> +    exit_fail
> +}
> +
> +if [ ! -f set_event ]; then
> +    echo "event tracing is not supported"
> +    exit_unsupported
> +fi
> +
> +if [ ! -d events/ftrace/print ]; then
> +    echo "event trace_marker is not supported"
> +    exit_unsupported
> +fi
> +
> +if [ ! -f events/ftrace/print/trigger ]; then
> +    echo "event trigger is not supported"
> +    exit_unsupported
> +fi
> +
> +if [ ! -f events/ftrace/print/hist ]; then
> +    echo "hist trigger is not supported"
> +    exit_unsupported
> +fi
> +
> +do_reset
> +
> +echo "Test histogram trace_marker tigger"
> +
> +echo 'hist:keys=common_pid' > events/ftrace/print/trigger
> +for i in `seq 1 10` ; do echo "hello" > trace_marker; done
> +grep 'hitcount: *10$' events/ftrace/print/hist > /dev/null || \
> +    fail "hist trigger did not trigger correct times on trace_marker"
> +
> +do_reset
> +
> +exit 0
> -- 
> 2.17.0
> 
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

  reply	other threads:[~2018-05-16 13:07 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-14 20:58 [PATCH v2 00/14] tracing: Add triggers to trace_marker writes Steven Rostedt
2018-05-14 20:58 ` [PATCH v2 01/14] tracing: Do not reference event data in post call triggers Steven Rostedt
2018-05-14 20:58 ` [PATCH v2 02/14] tracing: Add __find_event_file() to find event files without restrictions Steven Rostedt
2018-05-14 20:58 ` [PATCH v2 03/14] tracing: Have event_trace_init() called by trace_init_tracefs() Steven Rostedt
2018-05-14 20:58 ` [PATCH v2 04/14] tracing: Add brackets in ftrace event dynamic arrays Steven Rostedt
2018-05-14 20:58 ` [PATCH v2 05/14] tracing: Do not show filter file for ftrace internal events Steven Rostedt
2018-05-16  9:10   ` Namhyung Kim
2018-05-16 10:44     ` Steven Rostedt
2018-05-14 20:58 ` [PATCH v2 06/14] tracing: Add trigger file for trace_markers tracefs/ftrace/print Steven Rostedt
2018-05-14 20:58 ` [PATCH v2 07/14] tracing: Have zero size length in filter logic be full string Steven Rostedt
2018-05-14 20:58 ` [PATCH v2 08/14] tracing: Prevent further users of zero size static arrays in trace events Steven Rostedt
2018-05-14 20:58 ` [PATCH v2 09/14] tracing: Allow histogram triggers to access ftrace internal events Steven Rostedt
2018-05-14 20:58 ` [PATCH v2 10/14] tracing: Document trace_marker triggers Steven Rostedt
2018-05-14 21:47   ` Tom Zanussi
2018-05-16 13:55     ` Steven Rostedt
2018-05-16 15:22       ` Tom Zanussi
2018-05-16 15:26         ` Steven Rostedt
2018-05-14 20:58 ` [PATCH v2 11/14] ftrace/selftest: Have the reset_trigger code be a bit more careful Steven Rostedt
2018-05-16 12:53   ` Masami Hiramatsu
2018-05-16 14:00     ` Steven Rostedt
2018-05-16 23:15       ` Masami Hiramatsu
2018-05-14 20:58 ` [PATCH v2 12/14] ftrace/selftest: Fix reset_trigger() to handle triggers with filters Steven Rostedt
2018-05-16 12:56   ` Masami Hiramatsu
2018-05-16 14:04     ` Steven Rostedt
2018-05-14 20:58 ` [PATCH v2 13/14] tracing/selftest: Add selftests to test trace_marker histogram triggers Steven Rostedt
2018-05-16 13:07   ` Masami Hiramatsu [this message]
2018-05-16 14:06     ` Steven Rostedt
2018-05-14 20:58 ` [PATCH v2 14/14] tracing/selftest: Add test to test hist trigger between kernel event and trace_marker Steven Rostedt
2018-05-16  9:11   ` Namhyung Kim
2018-05-16 14:09     ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180516220716.60174e9edd8d9f970fcd37e1@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=bgregg@netflix.com \
    --cc=joel@joelfernandes.org \
    --cc=karim.yaghmour@opersys.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=tom.zanussi@linux.intel.com \
    --cc=williams@redhat.com \
    --cc=ylavic.dev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).