public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] perf evlist: Introduce perf_evlist__close()
@ 2013-03-15  5:48 Namhyung Kim
  2013-03-15  5:48 ` [PATCH 2/6] perf evsel: Cleanup perf_evsel__exit() Namhyung Kim
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Namhyung Kim @ 2013-03-15  5:48 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML,
	Jiri Olsa, David Ahern

From: Namhyung Kim <namhyung.kim@lge.com>

It's a pair of perf_evlist__open().

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/util/evlist.c | 19 ++++++++++++-------
 tools/perf/util/evlist.h |  1 +
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 5b012b8d7a14..1344fbd2472e 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -721,10 +721,20 @@ void perf_evlist__set_selected(struct perf_evlist *evlist,
 	evlist->selected = evsel;
 }
 
+void perf_evlist__close(struct perf_evlist *evlist)
+{
+	struct perf_evsel *evsel;
+	int ncpus = cpu_map__nr(evlist->cpus);
+	int nthreads = thread_map__nr(evlist->threads);
+
+	list_for_each_entry_reverse(evsel, &evlist->entries, node)
+		perf_evsel__close(evsel, ncpus, nthreads);
+}
+
 int perf_evlist__open(struct perf_evlist *evlist)
 {
 	struct perf_evsel *evsel;
-	int err, ncpus, nthreads;
+	int err;
 
 	list_for_each_entry(evsel, &evlist->entries, node) {
 		err = perf_evsel__open(evsel, evlist->cpus, evlist->threads);
@@ -734,12 +744,7 @@ int perf_evlist__open(struct perf_evlist *evlist)
 
 	return 0;
 out_err:
-	ncpus = cpu_map__nr(evlist->cpus);
-	nthreads = thread_map__nr(evlist->threads);
-
-	list_for_each_entry_reverse(evsel, &evlist->entries, node)
-		perf_evsel__close(evsel, ncpus, nthreads);
-
+	perf_evlist__close(evlist);
 	errno = -err;
 	return err;
 }
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index c096da7d6d58..0583d36252be 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -81,6 +81,7 @@ struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id);
 union perf_event *perf_evlist__mmap_read(struct perf_evlist *self, int idx);
 
 int perf_evlist__open(struct perf_evlist *evlist);
+void perf_evlist__close(struct perf_evlist *evlist);
 
 void perf_evlist__config(struct perf_evlist *evlist,
 			 struct perf_record_opts *opts);
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-03-21 11:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-15  5:48 [PATCH 1/6] perf evlist: Introduce perf_evlist__close() Namhyung Kim
2013-03-15  5:48 ` [PATCH 2/6] perf evsel: Cleanup perf_evsel__exit() Namhyung Kim
2013-03-21 11:40   ` [tip:perf/core] " tip-bot for Namhyung Kim
2013-03-15  5:48 ` [PATCH 3/6] perf trace: Free evlist resources properly on return path Namhyung Kim
2013-03-21 11:42   ` [tip:perf/core] " tip-bot for Namhyung Kim
2013-03-15  5:48 ` [PATCH 4/6] perf record: Fixup return path of cmd_record() Namhyung Kim
2013-03-21 11:44   ` [tip:perf/core] " tip-bot for Namhyung Kim
2013-03-15  5:48 ` [PATCH 5/6] perf test: Fixup return path of open-syscall-tp-fields test case Namhyung Kim
2013-03-21 11:45   ` [tip:perf/core] perf tests: " tip-bot for Namhyung Kim
2013-03-15  5:48 ` [PATCH 6/6] perf test: Fixup return path of perf record " Namhyung Kim
2013-03-21 11:46   ` [tip:perf/core] perf tests: " tip-bot for Namhyung Kim
2013-03-21 11:41 ` [tip:perf/core] perf evlist: Introduce perf_evlist__close() tip-bot for Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox