diff options
author | Jiri Olsa <jolsa@kernel.org> | 2019-07-21 13:24:50 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-07-29 18:34:46 -0300 |
commit | 88761fa1f1e3fb2df86727ac99f88abf2ac7e00b (patch) | |
tree | d2f1c05fe87394f6047fdbf377462b6452827021 /tools/perf/util/evsel.c | |
parent | 50a4e6fa450c4e5b688814a7ec8236d0de6e38bf (diff) | |
download | linux-88761fa1f1e3fb2df86727ac99f88abf2ac7e00b.tar.gz linux-88761fa1f1e3fb2df86727ac99f88abf2ac7e00b.tar.bz2 linux-88761fa1f1e3fb2df86727ac99f88abf2ac7e00b.zip |
libperf: Adopt simplified perf_evsel__close() function from tools/perf
Add perf_evsel__close() function to libperf while keeping a tools/perf
specific evsel__close() to free ids.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20190721112506.12306-64-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/evsel.c')
-rw-r--r-- | tools/perf/util/evsel.c | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index d3c8488f7069..8d8ed36377f5 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -1265,12 +1265,6 @@ int perf_evsel__alloc_id(struct evsel *evsel, int ncpus, int nthreads) return 0; } -static void perf_evsel__free_fd(struct evsel *evsel) -{ - xyarray__delete(evsel->core.fd); - evsel->core.fd = NULL; -} - static void perf_evsel__free_id(struct evsel *evsel) { xyarray__delete(evsel->sample_id); @@ -1289,23 +1283,12 @@ static void perf_evsel__free_config_terms(struct evsel *evsel) } } -void perf_evsel__close_fd(struct evsel *evsel) -{ - int cpu, thread; - - for (cpu = 0; cpu < xyarray__max_x(evsel->core.fd); cpu++) - for (thread = 0; thread < xyarray__max_y(evsel->core.fd); ++thread) { - close(FD(evsel, cpu, thread)); - FD(evsel, cpu, thread) = -1; - } -} - void perf_evsel__exit(struct evsel *evsel) { assert(list_empty(&evsel->core.node)); assert(evsel->evlist == NULL); perf_evsel__free_counts(evsel); - perf_evsel__free_fd(evsel); + perf_evsel__free_fd(&evsel->core); perf_evsel__free_id(evsel); perf_evsel__free_config_terms(evsel); cgroup__put(evsel->cgrp); @@ -2057,13 +2040,9 @@ out_close: return err; } -void perf_evsel__close(struct evsel *evsel) +void evsel__close(struct evsel *evsel) { - if (evsel->core.fd == NULL) - return; - - perf_evsel__close_fd(evsel); - perf_evsel__free_fd(evsel); + perf_evsel__close(&evsel->core); perf_evsel__free_id(evsel); } |