Re: [PATCH 1/2] libperf: Add perf_evlist__reset_id_hash()

From: Jiri Olsa
Date: Wed Feb 24 2021 - 07:34:27 EST


On Wed, Feb 24, 2021 at 05:42:15PM +0900, Namhyung Kim wrote:
> On Wed, Feb 24, 2021 at 5:11 PM Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
> >
> > Add the perf_evlist__reset_id_hash() function to libperf API so that
> > it can be called to reset the hash table. This is necessary for perf
> > stat to run the workload multiple times.
> >
> > Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
> > ---
> [SNIP]
> > diff --git a/tools/lib/perf/libperf.map b/tools/lib/perf/libperf.map
> > index 7be1af8a546c..285100143d89 100644
> > --- a/tools/lib/perf/libperf.map
> > +++ b/tools/lib/perf/libperf.map
> > @@ -42,6 +42,7 @@ LIBPERF_0.0.1 {
> > perf_evlist__munmap;
> > perf_evlist__filter_pollfd;
> > perf_evlist__next_mmap;
> > + perf_evlist__reset_id_hash;
> > perf_mmap__consume;
> > perf_mmap__read_init;
> > perf_mmap__read_done;
>
> I saw perf_evsel__free_fd and perf_evsel__free_id is called from
> util/evlist.c without being listed here. Do we need to add them?

perf is special user of libperf and we link it statically
at the moment, so it's not needed

I think we should add perf_evlist__reset_id_hash to internal
header, because for libperf.so we expose only logical API units
with described usage, not just single (special purpose) function

thanks,
jirka