Re: [PATCH v2 06/12] tracing: Add synthetic event command generation functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 10 Jan 2020 14:35:12 -0600
Tom Zanussi <zanussi@xxxxxxxxxx> 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@xxxxxxxxxx>
> ---
>  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



[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux