Messages in this thread Patch in this message | | | From | Arnaldo Carvalho de Melo <> | Date | Sat, 18 Apr 2020 08:50:17 -0300 | Subject | Re: [PATCH 12/16] perf tools: Move and globalize perf_evsel__find_pmu() and perf_evsel__is_aux_event() |
| |
Em Wed, Apr 01, 2020 at 01:16:09PM +0300, Adrian Hunter escreveu: > Move and globalize 2 functions so that they can be reused.
So this breaks this:
[acme@five perf]$ perf test -v python Couldn't bump rlimit(MEMLOCK), failures may take place when creating BPF maps, etc 19: 'import perf' in python : --- start --- test child forked, pid 168414 Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: /tmp/build/perf/python/perf.so: undefined symbol: perf_pmu__scan test child finished with -1 ---- end ---- 'import perf' in python: FAILED! [acme@five perf]$
I'm trying to fix... > Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> > --- > tools/perf/util/auxtrace.c | 19 ------------------- > tools/perf/util/evsel.c | 20 ++++++++++++++++++++ > tools/perf/util/evsel.h | 3 +++ > 3 files changed, 23 insertions(+), 19 deletions(-) > > diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c > index 809a09e75c55..33ad33378a90 100644 > --- a/tools/perf/util/auxtrace.c > +++ b/tools/perf/util/auxtrace.c > @@ -58,25 +58,6 @@ > #include "symbol/kallsyms.h" > #include <internal/lib.h> > > -static struct perf_pmu *perf_evsel__find_pmu(struct evsel *evsel) > -{ > - struct perf_pmu *pmu = NULL; > - > - while ((pmu = perf_pmu__scan(pmu)) != NULL) { > - if (pmu->type == evsel->core.attr.type) > - break; > - } > - > - return pmu; > -} > - > -static bool perf_evsel__is_aux_event(struct evsel *evsel) > -{ > - struct perf_pmu *pmu = perf_evsel__find_pmu(evsel); > - > - return pmu && pmu->auxtrace; > -} > - > /* > * Make a group from 'leader' to 'last', requiring that the events were not > * already grouped to a different leader. > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c > index 60e6cd49dee3..d4ab073c9fe7 100644 > --- a/tools/perf/util/evsel.c > +++ b/tools/perf/util/evsel.c > @@ -44,6 +44,7 @@ > #include "stat.h" > #include "string2.h" > #include "memswap.h" > +#include "pmu.h" > #include "util.h" > #include "../perf-sys.h" > #include "util/parse-branch-options.h" > @@ -100,6 +101,25 @@ int perf_evsel__object_config(size_t object_size, > return 0; > } > > +struct perf_pmu *perf_evsel__find_pmu(struct evsel *evsel) > +{ > + struct perf_pmu *pmu = NULL; > + > + while ((pmu = perf_pmu__scan(pmu)) != NULL) { > + if (pmu->type == evsel->core.attr.type) > + break; > + } > + > + return pmu; > +} > + > +bool perf_evsel__is_aux_event(struct evsel *evsel) > +{ > + struct perf_pmu *pmu = perf_evsel__find_pmu(evsel); > + > + return pmu && pmu->auxtrace; > +} > + > #define FD(e, x, y) (*(int *)xyarray__entry(e->core.fd, x, y)) > > int __perf_evsel__sample_size(u64 sample_type) > diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h > index e64ed4202cab..a463bc65b001 100644 > --- a/tools/perf/util/evsel.h > +++ b/tools/perf/util/evsel.h > @@ -158,6 +158,9 @@ int perf_evsel__object_config(size_t object_size, > int (*init)(struct evsel *evsel), > void (*fini)(struct evsel *evsel)); > > +struct perf_pmu *perf_evsel__find_pmu(struct evsel *evsel); > +bool perf_evsel__is_aux_event(struct evsel *evsel); > + > struct evsel *perf_evsel__new_idx(struct perf_event_attr *attr, int idx); > > static inline struct evsel *evsel__new(struct perf_event_attr *attr) > -- > 2.17.1 >
--
- Arnaldo
| |