summaryrefslogtreecommitdiff
path: root/tools/perf/lib/evlist.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2019-10-07 14:53:32 +0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-10-10 12:56:01 -0300
commit93dd6e2831ff399f7685aa2157b997b6392efac8 (patch)
tree02249cc1fa78b43bb06ee302bb798019471a6d9d /tools/perf/lib/evlist.c
parent230662e15ed6cc63ecf72ed1bffa3cadef486850 (diff)
libperf: Introduce perf_evlist__exit()
Add the perf_evlist__exit() function, so far it's not exported and added only for internal use for perf and libperf. USe it to release cpus/threads and pollfd array. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lore.kernel.org/lkml/20191007125344.14268-25-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/lib/evlist.c')
-rw-r--r--tools/perf/lib/evlist.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/perf/lib/evlist.c b/tools/perf/lib/evlist.c
index 5ae1da97d2e6..7ba98f0e6365 100644
--- a/tools/perf/lib/evlist.c
+++ b/tools/perf/lib/evlist.c
@@ -109,13 +109,23 @@ perf_evlist__next(struct perf_evlist *evlist, struct perf_evsel *prev)
return next;
}
+void perf_evlist__exit(struct perf_evlist *evlist)
+{
+ perf_cpu_map__put(evlist->cpus);
+ perf_thread_map__put(evlist->threads);
+ evlist->cpus = NULL;
+ evlist->threads = NULL;
+ fdarray__exit(&evlist->pollfd);
+}
+
void perf_evlist__delete(struct perf_evlist *evlist)
{
if (evlist == NULL)
return;
perf_evlist__munmap(evlist);
- fdarray__exit(&evlist->pollfd);
+ perf_evlist__close(evlist);
+ perf_evlist__exit(evlist);
free(evlist);
}