[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200726074737.GB1175442@krava>
Date: Sun, 26 Jul 2020 09:47:37 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Ian Rogers <irogers@...gle.com>
Cc: Jiri Olsa <jolsa@...nel.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Jin Yao <yao.jin@...ux.intel.com>,
lkml <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Michael Petlan <mpetlan@...hat.com>,
Stephane Eranian <eranian@...gle.com>,
Andi Kleen <ak@...ux.intel.com>,
Thomas Richter <tmricht@...ux.ibm.com>
Subject: Re: [PATCH 2/2] perf tools: Fix term parsing for raw syntax
On Sat, Jul 25, 2020 at 09:58:13AM -0700, Ian Rogers wrote:
SNIP
> > ret = parse_events_terms(&terms, t->str);
> > if (ret) {
> > pr_debug("failed to parse terms '%s', err %d\n",
> > diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> > index e88e4c7a2a9a..254f02a7fb0d 100644
> > --- a/tools/perf/util/parse-events.c
> > +++ b/tools/perf/util/parse-events.c
> > @@ -2019,6 +2019,27 @@ static void perf_pmu__parse_init(void)
> > perf_pmu__parse_cleanup();
> > }
> >
> > +int perf_pmu__test_parse_init(void)
> > +{
> > + struct perf_pmu_event_symbol *list;
> > +
> > + list = malloc(sizeof(*list) * 1);
> > + if (!list)
> > + return -ENOMEM;
> > +
> > + list->type = PMU_EVENT_SYMBOL;
> > + list->symbol = strdup("read");
> > +
> > + if (!list->symbol) {
> > + free(list);
> > + return -ENOMEM;
> > + }
> > +
> > + perf_pmu_events_list = list;
> > + perf_pmu_events_list_num = 1;
> > + return 0;
> > +}
>
> nit: It's easy to see in the test code why this is necessary, could
> the function be moved there? If not perhaps add a function comment?
> The test in the function name is quite load bearing.
both perf_pmu_events_list/cnt are static and I'd like to keep it that
way, so the function needs to be in here.. I'll add comment explaining
this
jirka
Powered by blists - more mailing lists