mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Jin Yao <yao.jin@linux.intel.com>,
	lkml <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Michael Petlan <mpetlan@redhat.com>,
	Stephane Eranian <eranian@google.com>,
	Andi Kleen <ak@linux.intel.com>,
	Thomas Richter <tmricht@linux.ibm.com>
Subject: Re: [PATCH 2/2] perf tools: Fix term parsing for raw syntax
Date: Sun, 26 Jul 2020 09:47:37 +0200	[thread overview]
Message-ID: <20200726074737.GB1175442@krava> (raw)
In-Reply-To: <CAP-5=fUmJSZfCrP=gdYOwd2gpAgXsiSTBDwtLp=_e7a434weTA@mail.gmail.com>

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


  reply	other threads:[~2020-07-26  7:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-25 12:19 [PATCH 1/2] perf tools: Allow r0x<HEX> event syntax Jiri Olsa
2020-07-25 12:19 ` [PATCH 2/2] perf tools: Fix term parsing for raw syntax Jiri Olsa
2020-07-25 16:58   ` Ian Rogers
2020-07-26  7:47     ` Jiri Olsa [this message]
2020-07-25 16:40 ` [PATCH 1/2] perf tools: Allow r0x<HEX> event syntax Ian Rogers
2020-07-28 12:15   ` Arnaldo Carvalho de Melo

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=20200726074737.GB1175442@krava \
    --to=jolsa@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=eranian@google.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mpetlan@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=tmricht@linux.ibm.com \
    --cc=yao.jin@linux.intel.com \
    /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

all inboxes | Powered by JetHome®