Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1172453
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 5/7] perf evlist: Propagate cpu maps to evsels in an evlist |
| Date | 2015-06-25 23:20 +0200 |
| Message-ID | <pFmIW-3FZ-17@gated-at.bofh.it> (permalink) |
| References | <pFmIW-3FZ-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Jiri Olsa <jolsa@kernel.org>
Propagate evlist's cpu_map object through all the evsel objects, while
keeping already configured evsel->cpus.
It'll be handy to access evsel's cpus directly in following patches.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1435012588-9007-6-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/evlist.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index a8d18a3d2164..214affaf1cf6 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -1101,6 +1101,29 @@ int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages,
return perf_evlist__mmap_ex(evlist, pages, overwrite, 0, false);
}
+static int perf_evlist__propagate_maps(struct perf_evlist *evlist,
+ struct target *target)
+{
+ struct perf_evsel *evsel;
+
+ evlist__for_each(evlist, evsel) {
+ /*
+ * We already have cpus for evsel (via PMU sysfs) so
+ * keep it, if there's no target cpu list defined.
+ */
+ if (evsel->cpus && target->cpu_list)
+ cpu_map__put(evsel->cpus);
+
+ if (!evsel->cpus || target->cpu_list)
+ evsel->cpus = cpu_map__get(evlist->cpus);
+
+ if (!evsel->cpus)
+ return -ENOMEM;
+ }
+
+ return 0;
+}
+
int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target)
{
evlist->threads = thread_map__new_str(target->pid, target->tid,
@@ -1117,7 +1140,7 @@ int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target)
if (evlist->cpus == NULL)
goto out_delete_threads;
- return 0;
+ return perf_evlist__propagate_maps(evlist, target);
out_delete_threads:
thread_map__put(evlist->threads);
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[GIT PULL 0/7] perf/core improvements Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-06-25 23:20 +0200 [PATCH 6/7] perf evlist: Propagate thread maps through the evlist Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-06-25 23:20 +0200 [PATCH 5/7] perf evlist: Propagate cpu maps to evsels in an evlist Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-06-25 23:20 +0200 [PATCH 7/7] perf tools: Make perf_evsel__(nr_)cpus generic Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-06-25 23:20 +0200 [PATCH 2/7] perf header: Delete an unnecessary check before the calling free_event_desc() Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-06-25 23:20 +0200
csiph-web