linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Tom Zanussi <zanussi@kernel.org>
Cc: rostedt@goodmis.org, tglx@linutronix.de, mhiramat@kernel.org,
	vedang.patel@intel.com, bigeasy@linutronix.de,
	joel@joelfernandes.org, mathieu.desnoyers@efficios.com,
	julia@ni.com, linux-kernel@vger.kernel.org,
	linux-rt-users@vger.kernel.org, kernel-team@lge.com
Subject: Re: [PATCH v11 10/15] tracing: Add alternative synthetic event trace action syntax
Date: Fri, 11 Jan 2019 15:07:52 +0900	[thread overview]
Message-ID: <20190111060752.GC625@sejong> (raw)
In-Reply-To: <f41e107a68bd018b388f7bd962d22a5bbc152598.1547062835.git.tom.zanussi@linux.intel.com>

On Wed, Jan 09, 2019 at 01:49:17PM -0600, Tom Zanussi wrote:
> From: Tom Zanussi <tom.zanussi@linux.intel.com>
> 
> Add a 'trace(synthetic_event_name, params)' alternative to
> synthetic_event_name(params).
> 
> Currently, the syntax used for generating synthetic events is to
> invoke synthetic_event_name(params) i.e. use the synthetic event name
> as a function call.
> 
> Users requested a new form that more explicitly shows that the
> synthetic event is in effect being traced.  In this version, a new
> 'trace()' keyword is used, and the synthetic event name is passed in
> as the first argument.
> 
> Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
> ---
>  Documentation/trace/histogram.rst | 21 ++++++++++++++++++++
>  kernel/trace/trace.c              |  1 +
>  kernel/trace/trace_events_hist.c  | 42 +++++++++++++++++++++++++++++++++++----
>  3 files changed, 60 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/trace/histogram.rst b/Documentation/trace/histogram.rst
> index 79476c906b1a..4939bad1c1cd 100644
> --- a/Documentation/trace/histogram.rst
> +++ b/Documentation/trace/histogram.rst
> @@ -1874,6 +1874,7 @@ The available handlers are:
>  The available actions are:
>  
>    - <synthetic_event_name>(param list)         - generate synthetic event
> +  - trace(<synthetic_event_name>,(param list)) - generate synthetic event

Shouldn't it be

	"trace(<synthetic_event_name>,param list)"

?  Otherwise it looks like we need two parentheses.

IMHO, it seems better for consistency using this new syntax only.
Of course it should support the old syntax as well for compatibility
(and maybe make it undocumented?).  But I won't insist strongly..


>    - save(field,...)                            - save current event fields
>    - snapshot()                                 - snapshot the trace buffer
>  
> @@ -1881,6 +1882,10 @@ The following commonly-used handler.action pairs are available:
>  
>    - onmatch(matching.event).<synthetic_event_name>(param list)
>  
> +    or
> +
> +  - onmatch(matching.event).trace(<synthetic_event_name>,(param list))
> +

Ditto.


>      The 'onmatch(matching.event).<synthetic_event_name>(params)' hist
>      trigger action is invoked whenever an event matches and the
>      histogram entry would be added or updated.  It causes the named
> @@ -1889,6 +1894,16 @@ The following commonly-used handler.action pairs are available:
>      that consists of the values contained in those variables at the
>      time the invoking event was hit.
>  
> +    There are two equivalent forms available for generating synthetic
> +    events.  In the first form, the synthetic event name is used as if
> +    it were a function name.  For example, if the synthetic event name
> +    is 'wakeup_latency', the wakeup_latency event would be generated
> +    by invoking it as if it were a function call, with the event field
> +    values passed in as arguments: wakeup_latency(arg1,arg2).  The
> +    second form simply uses the 'trace' keyword as the function name
> +    and passes in the synthetic event name as the first argument,
> +    followed by the field values: trace(wakeup_latency,arg1,arg2).
> +
>      The 'param list' consists of one or more parameters which may be
>      either variables or fields defined on either the 'matching.event'
>      or the target event.  The variables or fields specified in the
> @@ -1928,6 +1943,12 @@ The following commonly-used handler.action pairs are available:
>                wakeup_new_test($testpid) if comm=="cyclictest"' >> \
>                /sys/kernel/debug/tracing/events/sched/sched_wakeup_new/trigger
>  
> +    Or, equivalently, using the 'trace' keyword syntax:
> +
> +    # echo 'hist:keys=$testpid:testpid=pid:onmatch(sched.sched_wakeup_new).\
> +            trace(wakeup_new_test,$testpid) if comm=="cyclictest"' >> \
> +            /sys/kernel/debug/tracing/events/sched/sched_wakeup_new/trigger
> +
>      Creating and displaying a histogram based on those events is now
>      just a matter of using the fields and new synthetic event in the
>      tracing/events/synthetic directory, as usual::
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 917677a9bcaa..aae0e4127afc 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -4900,6 +4900,7 @@ static const char readme_msg[] =
>  	"\t        onchange(var)            - invoke action if var changes\n\n"
>  	"\t    The available actions are:\n\n"
>  	"\t        <synthetic_event>(param list)        - generate synthetic event\n"
> +	"\t        trace(<synthetic_event>,(param list))- generate synthetic event\n"

Ditto.

Thanks,
Namhyung


>  	"\t        save(field,...)                      - save current event fields\n"
>  	"\t        snapshot()                           - snapshot the trace buffer\n"
>  #endif

  reply	other threads:[~2019-01-11  6:07 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-09 19:49 [PATCH v11 00/15] tracing: Hist trigger snapshot and onchange additions Tom Zanussi
2019-01-09 19:49 ` [PATCH v11 01/15] tracing: Refactor hist trigger action code Tom Zanussi
2019-01-09 19:49 ` [PATCH v11 02/15] tracing: Make hist trigger Documentation better reflect actions/handlers Tom Zanussi
2019-01-09 19:49 ` [PATCH v11 03/15] tracing: Split up onmatch action data Tom Zanussi
2019-01-11  4:32   ` Namhyung Kim
2019-01-09 19:49 ` [PATCH v11 04/15] tracing: Generalize hist trigger onmax and save action Tom Zanussi
2019-01-09 19:49 ` [PATCH v11 05/15] tracing: Add conditional snapshot Tom Zanussi
2019-01-09 19:49 ` [PATCH v11 06/15] tracing: Add hist trigger snapshot() action Tom Zanussi
2019-01-09 19:49 ` [PATCH v11 07/15] tracing: Add hist trigger snapshot() action Documentation Tom Zanussi
2019-01-09 19:49 ` [PATCH v11 08/15] tracing: Add hist trigger onchange() handler Tom Zanussi
2019-01-09 19:49 ` [PATCH v11 09/15] tracing: Add hist trigger onchange() handler Documentation Tom Zanussi
2019-01-09 19:49 ` [PATCH v11 10/15] tracing: Add alternative synthetic event trace action syntax Tom Zanussi
2019-01-11  6:07   ` Namhyung Kim [this message]
2019-01-11 16:25     ` Tom Zanussi
2019-01-14  4:59       ` Namhyung Kim
2019-01-09 19:49 ` [PATCH v11 11/15] tracing: Add SPDX license GPL-2.0 license identifier to inter-event testcases Tom Zanussi
2019-01-09 19:49 ` [PATCH v11 12/15] tracing: Add hist trigger snapshot() action test case Tom Zanussi
2019-01-09 19:49 ` [PATCH v11 13/15] tracing: Add hist trigger onchange() handler " Tom Zanussi
2019-01-09 19:49 ` [PATCH v11 14/15] tracing: Add alternative synthetic event trace action " Tom Zanussi
2019-01-09 19:49 ` [PATCH v11 15/15] tracing: Add hist trigger action 'expected fail' " Tom Zanussi

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=20190111060752.GC625@sejong \
    --to=namhyung@kernel.org \
    --cc=bigeasy@linutronix.de \
    --cc=joel@joelfernandes.org \
    --cc=julia@ni.com \
    --cc=kernel-team@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=vedang.patel@intel.com \
    --cc=zanussi@kernel.org \
    /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).