diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2015-09-08 03:58:58 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-09-15 09:54:04 -0400 |
commit | adc0c3e87b0e1baeccabe09b6dba738f17d0e91d (patch) | |
tree | a74c082979be15860abd38197c55a5e5a18edff2 | |
parent | 74bfd2b25de354feb4484c553dce4fe8d9c3b60b (diff) |
perf evlist: Factor out a function to propagate maps for a single evsel
Subsequent fixes will need a function that just propagates maps for a
single evsel so factor it out.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@intel.com>
Link: http://lkml.kernel.org/r/1441699142-18905-11-git-send-email-adrian.hunter@intel.com
[ Moved them to before perf_evlist__add() to avoid having to move it in the next patch ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/util/evlist.c | 49 |
1 files changed, 27 insertions, 22 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index c17f3558a37a..4e840bfc19ef 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -124,6 +124,33 @@ void perf_evlist__delete(struct perf_evlist *evlist) | |||
124 | free(evlist); | 124 | free(evlist); |
125 | } | 125 | } |
126 | 126 | ||
127 | static void __perf_evlist__propagate_maps(struct perf_evlist *evlist, | ||
128 | struct perf_evsel *evsel) | ||
129 | { | ||
130 | /* | ||
131 | * We already have cpus for evsel (via PMU sysfs) so | ||
132 | * keep it, if there's no target cpu list defined. | ||
133 | */ | ||
134 | if (!evsel->own_cpus || evlist->has_user_cpus) { | ||
135 | cpu_map__put(evsel->cpus); | ||
136 | evsel->cpus = cpu_map__get(evlist->cpus); | ||
137 | } else if (evsel->cpus != evsel->own_cpus) { | ||
138 | cpu_map__put(evsel->cpus); | ||
139 | evsel->cpus = cpu_map__get(evsel->own_cpus); | ||
140 | } | ||
141 | |||
142 | thread_map__put(evsel->threads); | ||
143 | evsel->threads = thread_map__get(evlist->threads); | ||
144 | } | ||
145 | |||
146 | static void perf_evlist__propagate_maps(struct perf_evlist *evlist) | ||
147 | { | ||
148 | struct perf_evsel *evsel; | ||
149 | |||
150 | evlist__for_each(evlist, evsel) | ||
151 | __perf_evlist__propagate_maps(evlist, evsel); | ||
152 | } | ||
153 | |||
127 | void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry) | 154 | void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry) |
128 | { | 155 | { |
129 | entry->evlist = evlist; | 156 | entry->evlist = evlist; |
@@ -1102,28 +1129,6 @@ int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages, | |||
1102 | return perf_evlist__mmap_ex(evlist, pages, overwrite, 0, false); | 1129 | return perf_evlist__mmap_ex(evlist, pages, overwrite, 0, false); |
1103 | } | 1130 | } |
1104 | 1131 | ||
1105 | static void perf_evlist__propagate_maps(struct perf_evlist *evlist) | ||
1106 | { | ||
1107 | struct perf_evsel *evsel; | ||
1108 | |||
1109 | evlist__for_each(evlist, evsel) { | ||
1110 | /* | ||
1111 | * We already have cpus for evsel (via PMU sysfs) so | ||
1112 | * keep it, if there's no target cpu list defined. | ||
1113 | */ | ||
1114 | if (!evsel->own_cpus || evlist->has_user_cpus) { | ||
1115 | cpu_map__put(evsel->cpus); | ||
1116 | evsel->cpus = cpu_map__get(evlist->cpus); | ||
1117 | } else if (evsel->cpus != evsel->own_cpus) { | ||
1118 | cpu_map__put(evsel->cpus); | ||
1119 | evsel->cpus = cpu_map__get(evsel->own_cpus); | ||
1120 | } | ||
1121 | |||
1122 | thread_map__put(evsel->threads); | ||
1123 | evsel->threads = thread_map__get(evlist->threads); | ||
1124 | } | ||
1125 | } | ||
1126 | |||
1127 | int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target) | 1132 | int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target) |
1128 | { | 1133 | { |
1129 | struct cpu_map *cpus; | 1134 | struct cpu_map *cpus; |