Messages in this thread | | | From | Namhyung Kim <> | Date | Thu, 24 Sep 2020 15:35:44 +0900 | Subject | Re: [PATCH 5/5] perf test: Add expand cgroup event test |
| |
On Thu, Sep 24, 2020 at 7:36 AM Ian Rogers <irogers@google.com> wrote: > > On Tue, Sep 22, 2020 at 7:00 PM Namhyung Kim <namhyung@kernel.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@huawei.com> > > Signed-off-by: Namhyung Kim <namhyung@kernel.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; > > +} > > +
| |