Commit b7f0c203 authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

perf evlist: Propagate cpu maps to evsels in an evlist

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: default avatarJiri 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.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 186fbb74
...@@ -1101,6 +1101,29 @@ int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages, ...@@ -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); 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) int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target)
{ {
evlist->threads = thread_map__new_str(target->pid, target->tid, 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) ...@@ -1117,7 +1140,7 @@ int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target)
if (evlist->cpus == NULL) if (evlist->cpus == NULL)
goto out_delete_threads; goto out_delete_threads;
return 0; return perf_evlist__propagate_maps(evlist, target);
out_delete_threads: out_delete_threads:
thread_map__put(evlist->threads); thread_map__put(evlist->threads);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment