linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Tom Zanussi <zanussi@kernel.org>
Cc: artem.bityutskiy@linux.intel.com, mhiramat@kernel.org,
	linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org
Subject: Re: [PATCH v2 06/12] tracing: Add synthetic event command generation functions
Date: Tue, 21 Jan 2020 11:57:54 -0500	[thread overview]
Message-ID: <20200121115754.01efcdfd@gandalf.local.home> (raw)
In-Reply-To: <c731007e4b528f8bcd40d2864979597bd5d91183.1578688120.git.zanussi@kernel.org>

On Fri, 10 Jan 2020 14:35:12 -0600
Tom Zanussi <zanussi@kernel.org> wrote:

> Add functions used to generate synthetic event commands, built on top
> of the dynevent_cmd interface.
> 
> gen_synth_cmd() is used to create a synthetic event command using a
> variable arg list and gen_synth_cmd_array() does the same thing but
> using an array of field descriptors.  add_synth_field() and
> add_synth_fields() can be used to add single fields one by one or as a
> group.  Once all desired fields are added, create_dynevent() is used
> to actually execute the command and create the event.
> 
> create_synth_event() does everything, including creating the event, in
> a single call.
> 
> Signed-off-by: Tom Zanussi <zanussi@kernel.org>
> ---
>  include/linux/trace_events.h     |  30 ++++
>  kernel/trace/trace_events_hist.c | 325 ++++++++++++++++++++++++++++++++++++++-
>  2 files changed, 352 insertions(+), 3 deletions(-)
> 
> diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h
> index bf4cc2e56125..4228407d4736 100644
> --- a/include/linux/trace_events.h
> +++ b/include/linux/trace_events.h
> @@ -409,6 +409,36 @@ extern int create_dynevent(struct dynevent_cmd *cmd);
>  
>  extern int delete_synth_event(const char *name);
>  
> +extern void synth_dynevent_cmd_init(struct dynevent_cmd *cmd,
> +				    char *buf, int maxlen);
> +
> +extern int __gen_synth_cmd(struct dynevent_cmd *cmd, const char *name,
> +			   struct module *mod, ...);
> +
> +#define gen_synth_cmd(cmd, name, mod, ...)	\
> +	__gen_synth_cmd(cmd, name, mod, ## __VA_ARGS__, NULL)
> +
> +struct synth_field_desc {
> +	const char *type;
> +	const char *name;
> +};
> +
> +extern int gen_synth_cmd_array(struct dynevent_cmd *cmd, const char *name,
> +			       struct module *mod,
> +			       struct synth_field_desc *fields,
> +			       unsigned int n_fields);
> +extern int create_synth_event(const char *name,
> +			      struct synth_field_desc *fields,
> +			      unsigned int n_fields, struct module *mod);
> +
> +
> +extern int add_synth_field(struct dynevent_cmd *cmd,
> +			   const char *type,
> +			   const char *name);
> +extern int add_synth_fields(struct dynevent_cmd *cmd,
> +			    struct synth_field_desc *fields,
> +			    unsigned int n_fields);

As these are in a global header and globally visible, let's rename them
to be more name space aware.

Have them all start with "synth_event_".

synth_event_gen_cmd_array()
synth_event_create()
synth_event_add_field()
synth_event_add_fields()

Makes it easier to grep for synth_event functions too.

-- Steve


> +
>  /*
>   * Event file flags:
>   *  ENABLED	  - The event is enabled

  reply	other threads:[~2020-01-21 16:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-10 20:35 [PATCH v2 00/12] tracing: Add support for in-kernel dynamic event API Tom Zanussi
2020-01-10 20:35 ` [PATCH v2 01/12] tracing: Add trace_array_find() to find instance trace arrays Tom Zanussi
2020-01-10 20:35 ` [PATCH v2 02/12] tracing: Add get/put_event_file() Tom Zanussi
2020-01-13 13:15   ` Masami Hiramatsu
2020-01-13 15:15     ` Tom Zanussi
2020-01-10 20:35 ` [PATCH v2 03/12] tracing: Add delete_synth_event() Tom Zanussi
2020-01-10 20:35 ` [PATCH v2 04/12] tracing: Add dynamic event command creation interface Tom Zanussi
2020-01-14 12:14   ` Masami Hiramatsu
2020-01-14 15:19     ` Tom Zanussi
2020-01-10 20:35 ` [PATCH v2 05/12] tracing: Add synth_event_run_command() Tom Zanussi
2020-01-21 16:53   ` Steven Rostedt
2020-01-10 20:35 ` [PATCH v2 06/12] tracing: Add synthetic event command generation functions Tom Zanussi
2020-01-21 16:57   ` Steven Rostedt [this message]
2020-01-21 19:20     ` Tom Zanussi
2020-01-10 20:35 ` [PATCH v2 07/12] tracing: Add trace_synth_event() and related functions Tom Zanussi
2020-01-21 17:03   ` Steven Rostedt
2020-01-21 19:22     ` Tom Zanussi
2020-01-10 20:35 ` [PATCH v2 08/12] tracing: Add synth event generation test module Tom Zanussi
2020-01-10 20:35 ` [PATCH v2 09/12] tracing: Add trace_kprobe_run_command() Tom Zanussi
2020-01-10 20:35 ` [PATCH v2 10/12] tracing: Add kprobe event command generation functions Tom Zanussi
2020-01-10 20:35 ` [PATCH v2 11/12] tracing: Add kprobe event command generation test module Tom Zanussi
2020-01-10 20:35 ` [PATCH v2 12/12] tracing: Documentation for in-kernel synthetic event API 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=20200121115754.01efcdfd@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=artem.bityutskiy@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --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).