[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAM9d7cgdBxW4xG3M3ifPOFWBt0y3nSJiopeFd6AcUvec_o=1tQ@mail.gmail.com>
Date: Thu, 24 Sep 2020 15:35:44 +0900
From: Namhyung Kim <namhyung@...nel.org>
To: Ian Rogers <irogers@...gle.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Jiri Olsa <jolsa@...hat.com>, Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
LKML <linux-kernel@...r.kernel.org>,
Stephane Eranian <eranian@...gle.com>,
Andi Kleen <ak@...ux.intel.com>,
John Garry <john.garry@...wei.com>
Subject: Re: [PATCH 5/5] perf test: Add expand cgroup event test
On Thu, Sep 24, 2020 at 7:36 AM Ian Rogers <irogers@...gle.com> wrote:
>
> On Tue, Sep 22, 2020 at 7:00 PM Namhyung Kim <namhyung@...nel.org> wrote:
> >
> > It'll expand given events for cgroups A, B and C.
> >
> > $ ./perf test -v expansion
> > 69: Event expansion for cgroups :
> > --- start ---
> > test child forked, pid 983140
> > metric expr 1 / IPC for CPI
> > metric expr instructions / cycles for IPC
> > found event instructions
> > found event cycles
> > adding {instructions,cycles}:W
> > copying metric event for cgroup 'A': instructions (idx=0)
> > copying metric event for cgroup 'B': instructions (idx=0)
> > copying metric event for cgroup 'C': instructions (idx=0)
> > test child finished with 0
> > ---- end ----
> > Event expansion for cgroups: Ok
> >
> > Cc: John Garry <john.garry@...wei.com>
> > Signed-off-by: Namhyung Kim <namhyung@...nel.org>
> > ---
[SNIP]
> Should this be #ifdef HAVE_LIBPFM ?
Do you mean the below function?
Actually I thought about it and ended up not using it.
Please see below..
>
> > +static int expand_libpfm_events(void)
> > +{
> > + int ret;
> > + struct evlist *evlist;
> > + struct rblist metric_events;
> > + const char event_str[] = "UNHALTED_CORE_CYCLES";
> > + struct option opt = {
> > + .value = &evlist,
> > + };
> > +
> > + symbol_conf.event_group = true;
> > +
> > + evlist = evlist__new();
> > + TEST_ASSERT_VAL("failed to get evlist", evlist);
> > +
> > + ret = parse_libpfm_events_option(&opt, event_str, 0);
> > + if (ret < 0) {
> > + pr_debug("failed to parse libpfm event '%s', err %d\n",
> > + event_str, ret);
> > + goto out;
> > + }
> > + if (perf_evlist__empty(evlist)) {
> > + pr_debug("libpfm was not enabled\n");
> > + goto out;
> > + }
That's handled here. The parse_libpfm_events_option()
will return 0 if HAVE_LIBPFM is not defined so evlist will be empty.
Thanks
Namhyung
> > +
> > + rblist__init(&metric_events);
> > + ret = test_expand_events(evlist, &metric_events);
> > +out:
> > + evlist__delete(evlist);
> > + return ret;
> > +}
> > +
Powered by blists - more mailing lists