Re: [PATCH v5 3/7] perf/sdt: Directly record SDT events with 'perf record'

From: Jiri Olsa
Date: Wed Mar 15 2017 - 08:04:49 EST


On Tue, Mar 14, 2017 at 08:36:54PM +0530, Ravi Bangoria wrote:

SNIP

> ---
> tools/perf/builtin-record.c | 27 ++++++-
> tools/perf/util/parse-events.c | 60 +++++++++++++++
> tools/perf/util/parse-events.h | 3 +
> tools/perf/util/probe-event.c | 165 ++++++++++++++++++++++++++++++++++++++++-
> tools/perf/util/probe-event.h | 12 +++
> 5 files changed, 261 insertions(+), 6 deletions(-)
>
> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> index bc84a37..e8e1f73 100644
> --- a/tools/perf/builtin-record.c
> +++ b/tools/perf/builtin-record.c
> @@ -73,6 +73,7 @@ struct record {
> bool timestamp_filename;
> struct switch_output switch_output;
> unsigned long long samples;
> + struct list_head sdt_event_list;
> };
>
> static volatile int auxtrace_record__snapshot_started;
> @@ -1503,6 +1504,23 @@ static struct record record = {
> },
> };
>
> +static int record__parse_events_option(const struct option *opt,
> + const char *str,
> + int unset)
> +{
> + if (is_sdt_event((char *) str))
> + return parse_sdt_events_option(opt, str, unset);
> + else
> + return parse_events_option(opt, str, unset);

so what happens if there're more than one event in 'str' like:
-e cycles,std_...

would it be better to plug this directly into parse-events.y
parser.. and handle it like any other event type?

thanks,
jirka