diff options
author | Jiri Olsa <jolsa@kernel.org> | 2019-07-21 07:23:49 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-07-29 17:34:42 -0400 |
commit | f854839ba2a546a888159667c5ade96793e5cd10 (patch) | |
tree | 78f5b721321495a6c7e44c238efcfdfedc0a851d | |
parent | df1d6856eaa7ec9ad1e670685b370f3e66326079 (diff) |
perf cpu_map: Rename struct cpu_map to struct perf_cpu_map
Rename struct cpu_map to struct perf_cpu_map, so it could be part of
libperf.
Committer notes:
Added fixes for arm64, provided by Jiri.
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-3-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
52 files changed, 198 insertions, 198 deletions
diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c index 4208974c24f8..d08b55c27774 100644 --- a/tools/perf/arch/arm/util/cs-etm.c +++ b/tools/perf/arch/arm/util/cs-etm.c | |||
@@ -155,8 +155,8 @@ static int cs_etm_set_option(struct auxtrace_record *itr, | |||
155 | struct perf_evsel *evsel, u32 option) | 155 | struct perf_evsel *evsel, u32 option) |
156 | { | 156 | { |
157 | int i, err = -EINVAL; | 157 | int i, err = -EINVAL; |
158 | struct cpu_map *event_cpus = evsel->evlist->cpus; | 158 | struct perf_cpu_map *event_cpus = evsel->evlist->cpus; |
159 | struct cpu_map *online_cpus = cpu_map__new(NULL); | 159 | struct perf_cpu_map *online_cpus = cpu_map__new(NULL); |
160 | 160 | ||
161 | /* Set option of each CPU we have */ | 161 | /* Set option of each CPU we have */ |
162 | for (i = 0; i < cpu__max_cpu(); i++) { | 162 | for (i = 0; i < cpu__max_cpu(); i++) { |
@@ -253,7 +253,7 @@ static int cs_etm_recording_options(struct auxtrace_record *itr, | |||
253 | container_of(itr, struct cs_etm_recording, itr); | 253 | container_of(itr, struct cs_etm_recording, itr); |
254 | struct perf_pmu *cs_etm_pmu = ptr->cs_etm_pmu; | 254 | struct perf_pmu *cs_etm_pmu = ptr->cs_etm_pmu; |
255 | struct perf_evsel *evsel, *cs_etm_evsel = NULL; | 255 | struct perf_evsel *evsel, *cs_etm_evsel = NULL; |
256 | struct cpu_map *cpus = evlist->cpus; | 256 | struct perf_cpu_map *cpus = evlist->cpus; |
257 | bool privileged = (geteuid() == 0 || perf_event_paranoid() < 0); | 257 | bool privileged = (geteuid() == 0 || perf_event_paranoid() < 0); |
258 | int err = 0; | 258 | int err = 0; |
259 | 259 | ||
@@ -489,8 +489,8 @@ cs_etm_info_priv_size(struct auxtrace_record *itr __maybe_unused, | |||
489 | { | 489 | { |
490 | int i; | 490 | int i; |
491 | int etmv3 = 0, etmv4 = 0; | 491 | int etmv3 = 0, etmv4 = 0; |
492 | struct cpu_map *event_cpus = evlist->cpus; | 492 | struct perf_cpu_map *event_cpus = evlist->cpus; |
493 | struct cpu_map *online_cpus = cpu_map__new(NULL); | 493 | struct perf_cpu_map *online_cpus = cpu_map__new(NULL); |
494 | 494 | ||
495 | /* cpu map is not empty, we have specific CPUs to work with */ | 495 | /* cpu map is not empty, we have specific CPUs to work with */ |
496 | if (!cpu_map__empty(event_cpus)) { | 496 | if (!cpu_map__empty(event_cpus)) { |
@@ -635,9 +635,9 @@ static int cs_etm_info_fill(struct auxtrace_record *itr, | |||
635 | int i; | 635 | int i; |
636 | u32 offset; | 636 | u32 offset; |
637 | u64 nr_cpu, type; | 637 | u64 nr_cpu, type; |
638 | struct cpu_map *cpu_map; | 638 | struct perf_cpu_map *cpu_map; |
639 | struct cpu_map *event_cpus = session->evlist->cpus; | 639 | struct perf_cpu_map *event_cpus = session->evlist->cpus; |
640 | struct cpu_map *online_cpus = cpu_map__new(NULL); | 640 | struct perf_cpu_map *online_cpus = cpu_map__new(NULL); |
641 | struct cs_etm_recording *ptr = | 641 | struct cs_etm_recording *ptr = |
642 | container_of(itr, struct cs_etm_recording, itr); | 642 | container_of(itr, struct cs_etm_recording, itr); |
643 | struct perf_pmu *cs_etm_pmu = ptr->cs_etm_pmu; | 643 | struct perf_pmu *cs_etm_pmu = ptr->cs_etm_pmu; |
diff --git a/tools/perf/arch/arm64/util/header.c b/tools/perf/arch/arm64/util/header.c index 534cd2507d83..b3e73a413f5a 100644 --- a/tools/perf/arch/arm64/util/header.c +++ b/tools/perf/arch/arm64/util/header.c | |||
@@ -16,7 +16,7 @@ char *get_cpuid_str(struct perf_pmu *pmu) | |||
16 | const char *sysfs = sysfs__mountpoint(); | 16 | const char *sysfs = sysfs__mountpoint(); |
17 | int cpu; | 17 | int cpu; |
18 | u64 midr = 0; | 18 | u64 midr = 0; |
19 | struct cpu_map *cpus; | 19 | struct perf_cpu_map *cpus; |
20 | FILE *file; | 20 | FILE *file; |
21 | 21 | ||
22 | if (!sysfs || !pmu || !pmu->cpus) | 22 | if (!sysfs || !pmu || !pmu->cpus) |
diff --git a/tools/perf/arch/x86/tests/perf-time-to-tsc.c b/tools/perf/arch/x86/tests/perf-time-to-tsc.c index 7a7721604b86..4676fd967dc6 100644 --- a/tools/perf/arch/x86/tests/perf-time-to-tsc.c +++ b/tools/perf/arch/x86/tests/perf-time-to-tsc.c | |||
@@ -50,7 +50,7 @@ int test__perf_time_to_tsc(struct test *test __maybe_unused, int subtest __maybe | |||
50 | .sample_time = true, | 50 | .sample_time = true, |
51 | }; | 51 | }; |
52 | struct thread_map *threads = NULL; | 52 | struct thread_map *threads = NULL; |
53 | struct cpu_map *cpus = NULL; | 53 | struct perf_cpu_map *cpus = NULL; |
54 | struct perf_evlist *evlist = NULL; | 54 | struct perf_evlist *evlist = NULL; |
55 | struct perf_evsel *evsel = NULL; | 55 | struct perf_evsel *evsel = NULL; |
56 | int err = -1, ret, i; | 56 | int err = -1, ret, i; |
diff --git a/tools/perf/arch/x86/util/intel-bts.c b/tools/perf/arch/x86/util/intel-bts.c index ec5c1bb84095..da1583d27efd 100644 --- a/tools/perf/arch/x86/util/intel-bts.c +++ b/tools/perf/arch/x86/util/intel-bts.c | |||
@@ -106,7 +106,7 @@ static int intel_bts_recording_options(struct auxtrace_record *itr, | |||
106 | container_of(itr, struct intel_bts_recording, itr); | 106 | container_of(itr, struct intel_bts_recording, itr); |
107 | struct perf_pmu *intel_bts_pmu = btsr->intel_bts_pmu; | 107 | struct perf_pmu *intel_bts_pmu = btsr->intel_bts_pmu; |
108 | struct perf_evsel *evsel, *intel_bts_evsel = NULL; | 108 | struct perf_evsel *evsel, *intel_bts_evsel = NULL; |
109 | const struct cpu_map *cpus = evlist->cpus; | 109 | const struct perf_cpu_map *cpus = evlist->cpus; |
110 | bool privileged = geteuid() == 0 || perf_event_paranoid() < 0; | 110 | bool privileged = geteuid() == 0 || perf_event_paranoid() < 0; |
111 | 111 | ||
112 | btsr->evlist = evlist; | 112 | btsr->evlist = evlist; |
diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c index 609088c01e3a..69a23e40abc9 100644 --- a/tools/perf/arch/x86/util/intel-pt.c +++ b/tools/perf/arch/x86/util/intel-pt.c | |||
@@ -557,7 +557,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr, | |||
557 | struct perf_pmu *intel_pt_pmu = ptr->intel_pt_pmu; | 557 | struct perf_pmu *intel_pt_pmu = ptr->intel_pt_pmu; |
558 | bool have_timing_info, need_immediate = false; | 558 | bool have_timing_info, need_immediate = false; |
559 | struct perf_evsel *evsel, *intel_pt_evsel = NULL; | 559 | struct perf_evsel *evsel, *intel_pt_evsel = NULL; |
560 | const struct cpu_map *cpus = evlist->cpus; | 560 | const struct perf_cpu_map *cpus = evlist->cpus; |
561 | bool privileged = geteuid() == 0 || perf_event_paranoid() < 0; | 561 | bool privileged = geteuid() == 0 || perf_event_paranoid() < 0; |
562 | u64 tsc_bit; | 562 | u64 tsc_bit; |
563 | int err; | 563 | int err; |
diff --git a/tools/perf/bench/epoll-ctl.c b/tools/perf/bench/epoll-ctl.c index 2af067859966..1fd724f1d48b 100644 --- a/tools/perf/bench/epoll-ctl.c +++ b/tools/perf/bench/epoll-ctl.c | |||
@@ -219,7 +219,7 @@ static void init_fdmaps(struct worker *w, int pct) | |||
219 | } | 219 | } |
220 | } | 220 | } |
221 | 221 | ||
222 | static int do_threads(struct worker *worker, struct cpu_map *cpu) | 222 | static int do_threads(struct worker *worker, struct perf_cpu_map *cpu) |
223 | { | 223 | { |
224 | pthread_attr_t thread_attr, *attrp = NULL; | 224 | pthread_attr_t thread_attr, *attrp = NULL; |
225 | cpu_set_t cpuset; | 225 | cpu_set_t cpuset; |
@@ -301,7 +301,7 @@ int bench_epoll_ctl(int argc, const char **argv) | |||
301 | int j, ret = 0; | 301 | int j, ret = 0; |
302 | struct sigaction act; | 302 | struct sigaction act; |
303 | struct worker *worker = NULL; | 303 | struct worker *worker = NULL; |
304 | struct cpu_map *cpu; | 304 | struct perf_cpu_map *cpu; |
305 | struct rlimit rl, prevrl; | 305 | struct rlimit rl, prevrl; |
306 | unsigned int i; | 306 | unsigned int i; |
307 | 307 | ||
diff --git a/tools/perf/bench/epoll-wait.c b/tools/perf/bench/epoll-wait.c index fe85448abd45..79a254fff2d1 100644 --- a/tools/perf/bench/epoll-wait.c +++ b/tools/perf/bench/epoll-wait.c | |||
@@ -288,7 +288,7 @@ static void print_summary(void) | |||
288 | (int) runtime.tv_sec); | 288 | (int) runtime.tv_sec); |
289 | } | 289 | } |
290 | 290 | ||
291 | static int do_threads(struct worker *worker, struct cpu_map *cpu) | 291 | static int do_threads(struct worker *worker, struct perf_cpu_map *cpu) |
292 | { | 292 | { |
293 | pthread_attr_t thread_attr, *attrp = NULL; | 293 | pthread_attr_t thread_attr, *attrp = NULL; |
294 | cpu_set_t cpuset; | 294 | cpu_set_t cpuset; |
@@ -415,7 +415,7 @@ int bench_epoll_wait(int argc, const char **argv) | |||
415 | struct sigaction act; | 415 | struct sigaction act; |
416 | unsigned int i; | 416 | unsigned int i; |
417 | struct worker *worker = NULL; | 417 | struct worker *worker = NULL; |
418 | struct cpu_map *cpu; | 418 | struct perf_cpu_map *cpu; |
419 | pthread_t wthread; | 419 | pthread_t wthread; |
420 | struct rlimit rl, prevrl; | 420 | struct rlimit rl, prevrl; |
421 | 421 | ||
diff --git a/tools/perf/bench/futex-hash.c b/tools/perf/bench/futex-hash.c index a80797763e1f..b4fea8e3a368 100644 --- a/tools/perf/bench/futex-hash.c +++ b/tools/perf/bench/futex-hash.c | |||
@@ -124,7 +124,7 @@ int bench_futex_hash(int argc, const char **argv) | |||
124 | unsigned int i; | 124 | unsigned int i; |
125 | pthread_attr_t thread_attr; | 125 | pthread_attr_t thread_attr; |
126 | struct worker *worker = NULL; | 126 | struct worker *worker = NULL; |
127 | struct cpu_map *cpu; | 127 | struct perf_cpu_map *cpu; |
128 | 128 | ||
129 | argc = parse_options(argc, argv, options, bench_futex_hash_usage, 0); | 129 | argc = parse_options(argc, argv, options, bench_futex_hash_usage, 0); |
130 | if (argc) { | 130 | if (argc) { |
diff --git a/tools/perf/bench/futex-lock-pi.c b/tools/perf/bench/futex-lock-pi.c index d02330a69745..596769924709 100644 --- a/tools/perf/bench/futex-lock-pi.c +++ b/tools/perf/bench/futex-lock-pi.c | |||
@@ -116,7 +116,7 @@ static void *workerfn(void *arg) | |||
116 | } | 116 | } |
117 | 117 | ||
118 | static void create_threads(struct worker *w, pthread_attr_t thread_attr, | 118 | static void create_threads(struct worker *w, pthread_attr_t thread_attr, |
119 | struct cpu_map *cpu) | 119 | struct perf_cpu_map *cpu) |
120 | { | 120 | { |
121 | cpu_set_t cpuset; | 121 | cpu_set_t cpuset; |
122 | unsigned int i; | 122 | unsigned int i; |
@@ -150,7 +150,7 @@ int bench_futex_lock_pi(int argc, const char **argv) | |||
150 | unsigned int i; | 150 | unsigned int i; |
151 | struct sigaction act; | 151 | struct sigaction act; |
152 | pthread_attr_t thread_attr; | 152 | pthread_attr_t thread_attr; |
153 | struct cpu_map *cpu; | 153 | struct perf_cpu_map *cpu; |
154 | 154 | ||
155 | argc = parse_options(argc, argv, options, bench_futex_lock_pi_usage, 0); | 155 | argc = parse_options(argc, argv, options, bench_futex_lock_pi_usage, 0); |
156 | if (argc) | 156 | if (argc) |
diff --git a/tools/perf/bench/futex-requeue.c b/tools/perf/bench/futex-requeue.c index fc692efa0c05..1fd32a4f9c14 100644 --- a/tools/perf/bench/futex-requeue.c +++ b/tools/perf/bench/futex-requeue.c | |||
@@ -84,7 +84,7 @@ static void *workerfn(void *arg __maybe_unused) | |||
84 | } | 84 | } |
85 | 85 | ||
86 | static void block_threads(pthread_t *w, | 86 | static void block_threads(pthread_t *w, |
87 | pthread_attr_t thread_attr, struct cpu_map *cpu) | 87 | pthread_attr_t thread_attr, struct perf_cpu_map *cpu) |
88 | { | 88 | { |
89 | cpu_set_t cpuset; | 89 | cpu_set_t cpuset; |
90 | unsigned int i; | 90 | unsigned int i; |
@@ -117,7 +117,7 @@ int bench_futex_requeue(int argc, const char **argv) | |||
117 | unsigned int i, j; | 117 | unsigned int i, j; |
118 | struct sigaction act; | 118 | struct sigaction act; |
119 | pthread_attr_t thread_attr; | 119 | pthread_attr_t thread_attr; |
120 | struct cpu_map *cpu; | 120 | struct perf_cpu_map *cpu; |
121 | 121 | ||
122 | argc = parse_options(argc, argv, options, bench_futex_requeue_usage, 0); | 122 | argc = parse_options(argc, argv, options, bench_futex_requeue_usage, 0); |
123 | if (argc) | 123 | if (argc) |
diff --git a/tools/perf/bench/futex-wake-parallel.c b/tools/perf/bench/futex-wake-parallel.c index 69d8fdc87315..884c73e5bd1b 100644 --- a/tools/perf/bench/futex-wake-parallel.c +++ b/tools/perf/bench/futex-wake-parallel.c | |||
@@ -138,7 +138,7 @@ static void *blocked_workerfn(void *arg __maybe_unused) | |||
138 | } | 138 | } |
139 | 139 | ||
140 | static void block_threads(pthread_t *w, pthread_attr_t thread_attr, | 140 | static void block_threads(pthread_t *w, pthread_attr_t thread_attr, |
141 | struct cpu_map *cpu) | 141 | struct perf_cpu_map *cpu) |
142 | { | 142 | { |
143 | cpu_set_t cpuset; | 143 | cpu_set_t cpuset; |
144 | unsigned int i; | 144 | unsigned int i; |
@@ -224,7 +224,7 @@ int bench_futex_wake_parallel(int argc, const char **argv) | |||
224 | struct sigaction act; | 224 | struct sigaction act; |
225 | pthread_attr_t thread_attr; | 225 | pthread_attr_t thread_attr; |
226 | struct thread_data *waking_worker; | 226 | struct thread_data *waking_worker; |
227 | struct cpu_map *cpu; | 227 | struct perf_cpu_map *cpu; |
228 | 228 | ||
229 | argc = parse_options(argc, argv, options, | 229 | argc = parse_options(argc, argv, options, |
230 | bench_futex_wake_parallel_usage, 0); | 230 | bench_futex_wake_parallel_usage, 0); |
diff --git a/tools/perf/bench/futex-wake.c b/tools/perf/bench/futex-wake.c index e8181ad7d088..2288fa8412ff 100644 --- a/tools/perf/bench/futex-wake.c +++ b/tools/perf/bench/futex-wake.c | |||
@@ -90,7 +90,7 @@ static void print_summary(void) | |||
90 | } | 90 | } |
91 | 91 | ||
92 | static void block_threads(pthread_t *w, | 92 | static void block_threads(pthread_t *w, |
93 | pthread_attr_t thread_attr, struct cpu_map *cpu) | 93 | pthread_attr_t thread_attr, struct perf_cpu_map *cpu) |
94 | { | 94 | { |
95 | cpu_set_t cpuset; | 95 | cpu_set_t cpuset; |
96 | unsigned int i; | 96 | unsigned int i; |
@@ -123,7 +123,7 @@ int bench_futex_wake(int argc, const char **argv) | |||
123 | unsigned int i, j; | 123 | unsigned int i, j; |
124 | struct sigaction act; | 124 | struct sigaction act; |
125 | pthread_attr_t thread_attr; | 125 | pthread_attr_t thread_attr; |
126 | struct cpu_map *cpu; | 126 | struct perf_cpu_map *cpu; |
127 | 127 | ||
128 | argc = parse_options(argc, argv, options, bench_futex_wake_usage, 0); | 128 | argc = parse_options(argc, argv, options, bench_futex_wake_usage, 0); |
129 | if (argc) { | 129 | if (argc) { |
diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index e3776f5c2e01..52035dacf253 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c | |||
@@ -2049,7 +2049,7 @@ static int setup_nodes(struct perf_session *session) | |||
2049 | c2c.cpu2node = cpu2node; | 2049 | c2c.cpu2node = cpu2node; |
2050 | 2050 | ||
2051 | for (node = 0; node < c2c.nodes_cnt; node++) { | 2051 | for (node = 0; node < c2c.nodes_cnt; node++) { |
2052 | struct cpu_map *map = n[node].map; | 2052 | struct perf_cpu_map *map = n[node].map; |
2053 | unsigned long *set; | 2053 | unsigned long *set; |
2054 | 2054 | ||
2055 | set = bitmap_alloc(c2c.cpus_cnt); | 2055 | set = bitmap_alloc(c2c.cpus_cnt); |
diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c index 66d5a6658daf..3e81e0b6628f 100644 --- a/tools/perf/builtin-ftrace.c +++ b/tools/perf/builtin-ftrace.c | |||
@@ -165,7 +165,7 @@ static int set_tracing_pid(struct perf_ftrace *ftrace) | |||
165 | return 0; | 165 | return 0; |
166 | } | 166 | } |
167 | 167 | ||
168 | static int set_tracing_cpumask(struct cpu_map *cpumap) | 168 | static int set_tracing_cpumask(struct perf_cpu_map *cpumap) |
169 | { | 169 | { |
170 | char *cpumask; | 170 | char *cpumask; |
171 | size_t mask_size; | 171 | size_t mask_size; |
@@ -192,7 +192,7 @@ static int set_tracing_cpumask(struct cpu_map *cpumap) | |||
192 | 192 | ||
193 | static int set_tracing_cpu(struct perf_ftrace *ftrace) | 193 | static int set_tracing_cpu(struct perf_ftrace *ftrace) |
194 | { | 194 | { |
195 | struct cpu_map *cpumap = ftrace->evlist->cpus; | 195 | struct perf_cpu_map *cpumap = ftrace->evlist->cpus; |
196 | 196 | ||
197 | if (!target__has_cpu(&ftrace->target)) | 197 | if (!target__has_cpu(&ftrace->target)) |
198 | return 0; | 198 | return 0; |
@@ -202,7 +202,7 @@ static int set_tracing_cpu(struct perf_ftrace *ftrace) | |||
202 | 202 | ||
203 | static int reset_tracing_cpu(void) | 203 | static int reset_tracing_cpu(void) |
204 | { | 204 | { |
205 | struct cpu_map *cpumap = cpu_map__new(NULL); | 205 | struct perf_cpu_map *cpumap = cpu_map__new(NULL); |
206 | int ret; | 206 | int ret; |
207 | 207 | ||
208 | ret = set_tracing_cpumask(cpumap); | 208 | ret = set_tracing_cpumask(cpumap); |
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 56d1907b1215..51dd48f20972 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -161,9 +161,9 @@ struct perf_sched_map { | |||
161 | bool comp; | 161 | bool comp; |
162 | struct thread_map *color_pids; | 162 | struct thread_map *color_pids; |
163 | const char *color_pids_str; | 163 | const char *color_pids_str; |
164 | struct cpu_map *color_cpus; | 164 | struct perf_cpu_map *color_cpus; |
165 | const char *color_cpus_str; | 165 | const char *color_cpus_str; |
166 | struct cpu_map *cpus; | 166 | struct perf_cpu_map *cpus; |
167 | const char *cpus_str; | 167 | const char *cpus_str; |
168 | }; | 168 | }; |
169 | 169 | ||
@@ -3170,7 +3170,7 @@ static int perf_sched__lat(struct perf_sched *sched) | |||
3170 | 3170 | ||
3171 | static int setup_map_cpus(struct perf_sched *sched) | 3171 | static int setup_map_cpus(struct perf_sched *sched) |
3172 | { | 3172 | { |
3173 | struct cpu_map *map; | 3173 | struct perf_cpu_map *map; |
3174 | 3174 | ||
3175 | sched->max_cpu = sysconf(_SC_NPROCESSORS_CONF); | 3175 | sched->max_cpu = sysconf(_SC_NPROCESSORS_CONF); |
3176 | 3176 | ||
@@ -3212,7 +3212,7 @@ static int setup_color_pids(struct perf_sched *sched) | |||
3212 | 3212 | ||
3213 | static int setup_color_cpus(struct perf_sched *sched) | 3213 | static int setup_color_cpus(struct perf_sched *sched) |
3214 | { | 3214 | { |
3215 | struct cpu_map *map; | 3215 | struct perf_cpu_map *map; |
3216 | 3216 | ||
3217 | if (!sched->map.color_cpus_str) | 3217 | if (!sched->map.color_cpus_str) |
3218 | return 0; | 3218 | return 0; |
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 0140ddb8dd0b..0109c8710b93 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c | |||
@@ -1627,7 +1627,7 @@ struct perf_script { | |||
1627 | bool show_bpf_events; | 1627 | bool show_bpf_events; |
1628 | bool allocated; | 1628 | bool allocated; |
1629 | bool per_event_dump; | 1629 | bool per_event_dump; |
1630 | struct cpu_map *cpus; | 1630 | struct perf_cpu_map *cpus; |
1631 | struct thread_map *threads; | 1631 | struct thread_map *threads; |
1632 | int name_width; | 1632 | int name_width; |
1633 | const char *time_str; | 1633 | const char *time_str; |
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 7b9c26f9cf34..d68738b5bd0c 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -164,7 +164,7 @@ struct perf_stat { | |||
164 | u64 bytes_written; | 164 | u64 bytes_written; |
165 | struct perf_tool tool; | 165 | struct perf_tool tool; |
166 | bool maps_allocated; | 166 | bool maps_allocated; |
167 | struct cpu_map *cpus; | 167 | struct perf_cpu_map *cpus; |
168 | struct thread_map *threads; | 168 | struct thread_map *threads; |
169 | enum aggr_mode aggr_mode; | 169 | enum aggr_mode aggr_mode; |
170 | }; | 170 | }; |
@@ -803,24 +803,24 @@ static struct option stat_options[] = { | |||
803 | }; | 803 | }; |
804 | 804 | ||
805 | static int perf_stat__get_socket(struct perf_stat_config *config __maybe_unused, | 805 | static int perf_stat__get_socket(struct perf_stat_config *config __maybe_unused, |
806 | struct cpu_map *map, int cpu) | 806 | struct perf_cpu_map *map, int cpu) |
807 | { | 807 | { |
808 | return cpu_map__get_socket(map, cpu, NULL); | 808 | return cpu_map__get_socket(map, cpu, NULL); |
809 | } | 809 | } |
810 | 810 | ||
811 | static int perf_stat__get_die(struct perf_stat_config *config __maybe_unused, | 811 | static int perf_stat__get_die(struct perf_stat_config *config __maybe_unused, |
812 | struct cpu_map *map, int cpu) | 812 | struct perf_cpu_map *map, int cpu) |
813 | { | 813 | { |
814 | return cpu_map__get_die(map, cpu, NULL); | 814 | return cpu_map__get_die(map, cpu, NULL); |
815 | } | 815 | } |
816 | 816 | ||
817 | static int perf_stat__get_core(struct perf_stat_config *config __maybe_unused, | 817 | static int perf_stat__get_core(struct perf_stat_config *config __maybe_unused, |
818 | struct cpu_map *map, int cpu) | 818 | struct perf_cpu_map *map, int cpu) |
819 | { | 819 | { |
820 | return cpu_map__get_core(map, cpu, NULL); | 820 | return cpu_map__get_core(map, cpu, NULL); |
821 | } | 821 | } |
822 | 822 | ||
823 | static int cpu_map__get_max(struct cpu_map *map) | 823 | static int cpu_map__get_max(struct perf_cpu_map *map) |
824 | { | 824 | { |
825 | int i, max = -1; | 825 | int i, max = -1; |
826 | 826 | ||
@@ -833,7 +833,7 @@ static int cpu_map__get_max(struct cpu_map *map) | |||
833 | } | 833 | } |
834 | 834 | ||
835 | static int perf_stat__get_aggr(struct perf_stat_config *config, | 835 | static int perf_stat__get_aggr(struct perf_stat_config *config, |
836 | aggr_get_id_t get_id, struct cpu_map *map, int idx) | 836 | aggr_get_id_t get_id, struct perf_cpu_map *map, int idx) |
837 | { | 837 | { |
838 | int cpu; | 838 | int cpu; |
839 | 839 | ||
@@ -849,19 +849,19 @@ static int perf_stat__get_aggr(struct perf_stat_config *config, | |||
849 | } | 849 | } |
850 | 850 | ||
851 | static int perf_stat__get_socket_cached(struct perf_stat_config *config, | 851 | static int perf_stat__get_socket_cached(struct perf_stat_config *config, |
852 | struct cpu_map *map, int idx) | 852 | struct perf_cpu_map *map, int idx) |
853 | { | 853 | { |
854 | return perf_stat__get_aggr(config, perf_stat__get_socket, map, idx); | 854 | return perf_stat__get_aggr(config, perf_stat__get_socket, map, idx); |
855 | } | 855 | } |
856 | 856 | ||
857 | static int perf_stat__get_die_cached(struct perf_stat_config *config, | 857 | static int perf_stat__get_die_cached(struct perf_stat_config *config, |
858 | struct cpu_map *map, int idx) | 858 | struct perf_cpu_map *map, int idx) |
859 | { | 859 | { |
860 | return perf_stat__get_aggr(config, perf_stat__get_die, map, idx); | 860 | return perf_stat__get_aggr(config, perf_stat__get_die, map, idx); |
861 | } | 861 | } |
862 | 862 | ||
863 | static int perf_stat__get_core_cached(struct perf_stat_config *config, | 863 | static int perf_stat__get_core_cached(struct perf_stat_config *config, |
864 | struct cpu_map *map, int idx) | 864 | struct perf_cpu_map *map, int idx) |
865 | { | 865 | { |
866 | return perf_stat__get_aggr(config, perf_stat__get_core, map, idx); | 866 | return perf_stat__get_aggr(config, perf_stat__get_core, map, idx); |
867 | } | 867 | } |
@@ -939,7 +939,7 @@ static void perf_stat__exit_aggr_mode(void) | |||
939 | stat_config.cpus_aggr_map = NULL; | 939 | stat_config.cpus_aggr_map = NULL; |
940 | } | 940 | } |
941 | 941 | ||
942 | static inline int perf_env__get_cpu(struct perf_env *env, struct cpu_map *map, int idx) | 942 | static inline int perf_env__get_cpu(struct perf_env *env, struct perf_cpu_map *map, int idx) |
943 | { | 943 | { |
944 | int cpu; | 944 | int cpu; |
945 | 945 | ||
@@ -954,7 +954,7 @@ static inline int perf_env__get_cpu(struct perf_env *env, struct cpu_map *map, i | |||
954 | return cpu; | 954 | return cpu; |
955 | } | 955 | } |
956 | 956 | ||
957 | static int perf_env__get_socket(struct cpu_map *map, int idx, void *data) | 957 | static int perf_env__get_socket(struct perf_cpu_map *map, int idx, void *data) |
958 | { | 958 | { |
959 | struct perf_env *env = data; | 959 | struct perf_env *env = data; |
960 | int cpu = perf_env__get_cpu(env, map, idx); | 960 | int cpu = perf_env__get_cpu(env, map, idx); |
@@ -962,7 +962,7 @@ static int perf_env__get_socket(struct cpu_map *map, int idx, void *data) | |||
962 | return cpu == -1 ? -1 : env->cpu[cpu].socket_id; | 962 | return cpu == -1 ? -1 : env->cpu[cpu].socket_id; |
963 | } | 963 | } |
964 | 964 | ||
965 | static int perf_env__get_die(struct cpu_map *map, int idx, void *data) | 965 | static int perf_env__get_die(struct perf_cpu_map *map, int idx, void *data) |
966 | { | 966 | { |
967 | struct perf_env *env = data; | 967 | struct perf_env *env = data; |
968 | int die_id = -1, cpu = perf_env__get_cpu(env, map, idx); | 968 | int die_id = -1, cpu = perf_env__get_cpu(env, map, idx); |
@@ -986,7 +986,7 @@ static int perf_env__get_die(struct cpu_map *map, int idx, void *data) | |||
986 | return die_id; | 986 | return die_id; |
987 | } | 987 | } |
988 | 988 | ||
989 | static int perf_env__get_core(struct cpu_map *map, int idx, void *data) | 989 | static int perf_env__get_core(struct perf_cpu_map *map, int idx, void *data) |
990 | { | 990 | { |
991 | struct perf_env *env = data; | 991 | struct perf_env *env = data; |
992 | int core = -1, cpu = perf_env__get_cpu(env, map, idx); | 992 | int core = -1, cpu = perf_env__get_cpu(env, map, idx); |
@@ -1016,37 +1016,37 @@ static int perf_env__get_core(struct cpu_map *map, int idx, void *data) | |||
1016 | return core; | 1016 | return core; |
1017 | } | 1017 | } |
1018 | 1018 | ||
1019 | static int perf_env__build_socket_map(struct perf_env *env, struct cpu_map *cpus, | 1019 | static int perf_env__build_socket_map(struct perf_env *env, struct perf_cpu_map *cpus, |
1020 | struct cpu_map **sockp) | 1020 | struct perf_cpu_map **sockp) |
1021 | { | 1021 | { |
1022 | return cpu_map__build_map(cpus, sockp, perf_env__get_socket, env); | 1022 | return cpu_map__build_map(cpus, sockp, perf_env__get_socket, env); |
1023 | } | 1023 | } |
1024 | 1024 | ||
1025 | static int perf_env__build_die_map(struct perf_env *env, struct cpu_map *cpus, | 1025 | static int perf_env__build_die_map(struct perf_env *env, struct perf_cpu_map *cpus, |
1026 | struct cpu_map **diep) | 1026 | struct perf_cpu_map **diep) |
1027 | { | 1027 | { |
1028 | return cpu_map__build_map(cpus, diep, perf_env__get_die, env); | 1028 | return cpu_map__build_map(cpus, diep, perf_env__get_die, env); |
1029 | } | 1029 | } |
1030 | 1030 | ||
1031 | static int perf_env__build_core_map(struct perf_env *env, struct cpu_map *cpus, | 1031 | static int perf_env__build_core_map(struct perf_env *env, struct perf_cpu_map *cpus, |
1032 | struct cpu_map **corep) | 1032 | struct perf_cpu_map **corep) |
1033 | { | 1033 | { |
1034 | return cpu_map__build_map(cpus, corep, perf_env__get_core, env); | 1034 | return cpu_map__build_map(cpus, corep, perf_env__get_core, env); |
1035 | } | 1035 | } |
1036 | 1036 | ||
1037 | static int perf_stat__get_socket_file(struct perf_stat_config *config __maybe_unused, | 1037 | static int perf_stat__get_socket_file(struct perf_stat_config *config __maybe_unused, |
1038 | struct cpu_map *map, int idx) | 1038 | struct perf_cpu_map *map, int idx) |
1039 | { | 1039 | { |
1040 | return perf_env__get_socket(map, idx, &perf_stat.session->header.env); | 1040 | return perf_env__get_socket(map, idx, &perf_stat.session->header.env); |
1041 | } | 1041 | } |
1042 | static int perf_stat__get_die_file(struct perf_stat_config *config __maybe_unused, | 1042 | static int perf_stat__get_die_file(struct perf_stat_config *config __maybe_unused, |
1043 | struct cpu_map *map, int idx) | 1043 | struct perf_cpu_map *map, int idx) |
1044 | { | 1044 | { |
1045 | return perf_env__get_die(map, idx, &perf_stat.session->header.env); | 1045 | return perf_env__get_die(map, idx, &perf_stat.session->header.env); |
1046 | } | 1046 | } |
1047 | 1047 | ||
1048 | static int perf_stat__get_core_file(struct perf_stat_config *config __maybe_unused, | 1048 | static int perf_stat__get_core_file(struct perf_stat_config *config __maybe_unused, |
1049 | struct cpu_map *map, int idx) | 1049 | struct perf_cpu_map *map, int idx) |
1050 | { | 1050 | { |
1051 | return perf_env__get_core(map, idx, &perf_stat.session->header.env); | 1051 | return perf_env__get_core(map, idx, &perf_stat.session->header.env); |
1052 | } | 1052 | } |
@@ -1551,7 +1551,7 @@ int process_cpu_map_event(struct perf_session *session, | |||
1551 | { | 1551 | { |
1552 | struct perf_tool *tool = session->tool; | 1552 | struct perf_tool *tool = session->tool; |
1553 | struct perf_stat *st = container_of(tool, struct perf_stat, tool); | 1553 | struct perf_stat *st = container_of(tool, struct perf_stat, tool); |
1554 | struct cpu_map *cpus; | 1554 | struct perf_cpu_map *cpus; |
1555 | 1555 | ||
1556 | if (st->cpus) { | 1556 | if (st->cpus) { |
1557 | pr_warning("Extra cpu map event, ignoring.\n"); | 1557 | pr_warning("Extra cpu map event, ignoring.\n"); |
diff --git a/tools/perf/tests/bitmap.c b/tools/perf/tests/bitmap.c index 96e7fc1ad3f9..74d0cd32a5c4 100644 --- a/tools/perf/tests/bitmap.c +++ b/tools/perf/tests/bitmap.c | |||
@@ -9,7 +9,7 @@ | |||
9 | 9 | ||
10 | static unsigned long *get_bitmap(const char *str, int nbits) | 10 | static unsigned long *get_bitmap(const char *str, int nbits) |
11 | { | 11 | { |
12 | struct cpu_map *map = cpu_map__new(str); | 12 | struct perf_cpu_map *map = cpu_map__new(str); |
13 | unsigned long *bm = NULL; | 13 | unsigned long *bm = NULL; |
14 | int i; | 14 | int i; |
15 | 15 | ||
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c index aa6df122b175..948ec278ad06 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c | |||
@@ -553,7 +553,7 @@ static int do_test_code_reading(bool try_kcore) | |||
553 | .done_cnt = 0, | 553 | .done_cnt = 0, |
554 | }; | 554 | }; |
555 | struct thread_map *threads = NULL; | 555 | struct thread_map *threads = NULL; |
556 | struct cpu_map *cpus = NULL; | 556 | struct perf_cpu_map *cpus = NULL; |
557 | struct perf_evlist *evlist = NULL; | 557 | struct perf_evlist *evlist = NULL; |
558 | struct perf_evsel *evsel = NULL; | 558 | struct perf_evsel *evsel = NULL; |
559 | int err = -1, ret; | 559 | int err = -1, ret; |
diff --git a/tools/perf/tests/cpumap.c b/tools/perf/tests/cpumap.c index e78b897677bd..10da4400493d 100644 --- a/tools/perf/tests/cpumap.c +++ b/tools/perf/tests/cpumap.c | |||
@@ -17,7 +17,7 @@ static int process_event_mask(struct perf_tool *tool __maybe_unused, | |||
17 | struct cpu_map_event *map_event = &event->cpu_map; | 17 | struct cpu_map_event *map_event = &event->cpu_map; |
18 | struct cpu_map_mask *mask; | 18 | struct cpu_map_mask *mask; |
19 | struct cpu_map_data *data; | 19 | struct cpu_map_data *data; |
20 | struct cpu_map *map; | 20 | struct perf_cpu_map *map; |
21 | int i; | 21 | int i; |
22 | 22 | ||
23 | data = &map_event->data; | 23 | data = &map_event->data; |
@@ -51,7 +51,7 @@ static int process_event_cpus(struct perf_tool *tool __maybe_unused, | |||
51 | struct cpu_map_event *map_event = &event->cpu_map; | 51 | struct cpu_map_event *map_event = &event->cpu_map; |
52 | struct cpu_map_entries *cpus; | 52 | struct cpu_map_entries *cpus; |
53 | struct cpu_map_data *data; | 53 | struct cpu_map_data *data; |
54 | struct cpu_map *map; | 54 | struct perf_cpu_map *map; |
55 | 55 | ||
56 | data = &map_event->data; | 56 | data = &map_event->data; |
57 | 57 | ||
@@ -75,7 +75,7 @@ static int process_event_cpus(struct perf_tool *tool __maybe_unused, | |||
75 | 75 | ||
76 | int test__cpu_map_synthesize(struct test *test __maybe_unused, int subtest __maybe_unused) | 76 | int test__cpu_map_synthesize(struct test *test __maybe_unused, int subtest __maybe_unused) |
77 | { | 77 | { |
78 | struct cpu_map *cpus; | 78 | struct perf_cpu_map *cpus; |
79 | 79 | ||
80 | /* This one is better stores in mask. */ | 80 | /* This one is better stores in mask. */ |
81 | cpus = cpu_map__new("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19"); | 81 | cpus = cpu_map__new("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19"); |
@@ -97,7 +97,7 @@ int test__cpu_map_synthesize(struct test *test __maybe_unused, int subtest __may | |||
97 | 97 | ||
98 | static int cpu_map_print(const char *str) | 98 | static int cpu_map_print(const char *str) |
99 | { | 99 | { |
100 | struct cpu_map *map = cpu_map__new(str); | 100 | struct perf_cpu_map *map = cpu_map__new(str); |
101 | char buf[100]; | 101 | char buf[100]; |
102 | 102 | ||
103 | if (!map) | 103 | if (!map) |
diff --git a/tools/perf/tests/event-times.c b/tools/perf/tests/event-times.c index 1a2686f1fcf0..ed90b62bf048 100644 --- a/tools/perf/tests/event-times.c +++ b/tools/perf/tests/event-times.c | |||
@@ -110,7 +110,7 @@ static int detach__disable(struct perf_evlist *evlist) | |||
110 | static int attach__cpu_disabled(struct perf_evlist *evlist) | 110 | static int attach__cpu_disabled(struct perf_evlist *evlist) |
111 | { | 111 | { |
112 | struct perf_evsel *evsel = perf_evlist__last(evlist); | 112 | struct perf_evsel *evsel = perf_evlist__last(evlist); |
113 | struct cpu_map *cpus; | 113 | struct perf_cpu_map *cpus; |
114 | int err; | 114 | int err; |
115 | 115 | ||
116 | pr_debug("attaching to CPU 0 as enabled\n"); | 116 | pr_debug("attaching to CPU 0 as enabled\n"); |
@@ -139,7 +139,7 @@ static int attach__cpu_disabled(struct perf_evlist *evlist) | |||
139 | static int attach__cpu_enabled(struct perf_evlist *evlist) | 139 | static int attach__cpu_enabled(struct perf_evlist *evlist) |
140 | { | 140 | { |
141 | struct perf_evsel *evsel = perf_evlist__last(evlist); | 141 | struct perf_evsel *evsel = perf_evlist__last(evlist); |
142 | struct cpu_map *cpus; | 142 | struct perf_cpu_map *cpus; |
143 | int err; | 143 | int err; |
144 | 144 | ||
145 | pr_debug("attaching to CPU 0 as enabled\n"); | 145 | pr_debug("attaching to CPU 0 as enabled\n"); |
diff --git a/tools/perf/tests/event_update.c b/tools/perf/tests/event_update.c index f14dcd613438..b5042f019ec4 100644 --- a/tools/perf/tests/event_update.c +++ b/tools/perf/tests/event_update.c | |||
@@ -61,7 +61,7 @@ static int process_event_cpus(struct perf_tool *tool __maybe_unused, | |||
61 | { | 61 | { |
62 | struct event_update_event *ev = (struct event_update_event*) event; | 62 | struct event_update_event *ev = (struct event_update_event*) event; |
63 | struct event_update_event_cpus *ev_data; | 63 | struct event_update_event_cpus *ev_data; |
64 | struct cpu_map *map; | 64 | struct perf_cpu_map *map; |
65 | 65 | ||
66 | ev_data = (struct event_update_event_cpus*) ev->data; | 66 | ev_data = (struct event_update_event_cpus*) ev->data; |
67 | 67 | ||
diff --git a/tools/perf/tests/keep-tracking.c b/tools/perf/tests/keep-tracking.c index 17c46f3e6f1e..68331a81bcdd 100644 --- a/tools/perf/tests/keep-tracking.c +++ b/tools/perf/tests/keep-tracking.c | |||
@@ -66,7 +66,7 @@ int test__keep_tracking(struct test *test __maybe_unused, int subtest __maybe_un | |||
66 | }, | 66 | }, |
67 | }; | 67 | }; |
68 | struct thread_map *threads = NULL; | 68 | struct thread_map *threads = NULL; |
69 | struct cpu_map *cpus = NULL; | 69 | struct perf_cpu_map *cpus = NULL; |
70 | struct perf_evlist *evlist = NULL; | 70 | struct perf_evlist *evlist = NULL; |
71 | struct perf_evsel *evsel = NULL; | 71 | struct perf_evsel *evsel = NULL; |
72 | int found, err = -1; | 72 | int found, err = -1; |
diff --git a/tools/perf/tests/mem2node.c b/tools/perf/tests/mem2node.c index 520cc91af256..e12eedfba781 100644 --- a/tools/perf/tests/mem2node.c +++ b/tools/perf/tests/mem2node.c | |||
@@ -19,7 +19,7 @@ static struct node { | |||
19 | 19 | ||
20 | static unsigned long *get_bitmap(const char *str, int nbits) | 20 | static unsigned long *get_bitmap(const char *str, int nbits) |
21 | { | 21 | { |
22 | struct cpu_map *map = cpu_map__new(str); | 22 | struct perf_cpu_map *map = cpu_map__new(str); |
23 | unsigned long *bm = NULL; | 23 | unsigned long *bm = NULL; |
24 | int i; | 24 | int i; |
25 | 25 | ||
diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c index 0919b0793e5b..1bc8fd3ea510 100644 --- a/tools/perf/tests/mmap-basic.c +++ b/tools/perf/tests/mmap-basic.c | |||
@@ -28,7 +28,7 @@ int test__basic_mmap(struct test *test __maybe_unused, int subtest __maybe_unuse | |||
28 | int err = -1; | 28 | int err = -1; |
29 | union perf_event *event; | 29 | union perf_event *event; |
30 | struct thread_map *threads; | 30 | struct thread_map *threads; |
31 | struct cpu_map *cpus; | 31 | struct perf_cpu_map *cpus; |
32 | struct perf_evlist *evlist; | 32 | struct perf_evlist *evlist; |
33 | cpu_set_t cpu_set; | 33 | cpu_set_t cpu_set; |
34 | const char *syscall_names[] = { "getsid", "getppid", "getpgid", }; | 34 | const char *syscall_names[] = { "getsid", "getppid", "getpgid", }; |
diff --git a/tools/perf/tests/openat-syscall-all-cpus.c b/tools/perf/tests/openat-syscall-all-cpus.c index 493ecb611540..f393aa836dfb 100644 --- a/tools/perf/tests/openat-syscall-all-cpus.c +++ b/tools/perf/tests/openat-syscall-all-cpus.c | |||
@@ -20,7 +20,7 @@ | |||
20 | int test__openat_syscall_event_on_all_cpus(struct test *test __maybe_unused, int subtest __maybe_unused) | 20 | int test__openat_syscall_event_on_all_cpus(struct test *test __maybe_unused, int subtest __maybe_unused) |
21 | { | 21 | { |
22 | int err = -1, fd, cpu; | 22 | int err = -1, fd, cpu; |
23 | struct cpu_map *cpus; | 23 | struct perf_cpu_map *cpus; |
24 | struct perf_evsel *evsel; | 24 | struct perf_evsel *evsel; |
25 | unsigned int nr_openat_calls = 111, i; | 25 | unsigned int nr_openat_calls = 111, i; |
26 | cpu_set_t cpu_set; | 26 | cpu_set_t cpu_set; |
diff --git a/tools/perf/tests/sw-clock.c b/tools/perf/tests/sw-clock.c index f9490b237893..d9121b5033b7 100644 --- a/tools/perf/tests/sw-clock.c +++ b/tools/perf/tests/sw-clock.c | |||
@@ -37,7 +37,7 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id) | |||
37 | .disabled = 1, | 37 | .disabled = 1, |
38 | .freq = 1, | 38 | .freq = 1, |
39 | }; | 39 | }; |
40 | struct cpu_map *cpus; | 40 | struct perf_cpu_map *cpus; |
41 | struct thread_map *threads; | 41 | struct thread_map *threads; |
42 | struct perf_mmap *md; | 42 | struct perf_mmap *md; |
43 | 43 | ||
diff --git a/tools/perf/tests/switch-tracking.c b/tools/perf/tests/switch-tracking.c index 6cdab5f4812a..826f20a4cb51 100644 --- a/tools/perf/tests/switch-tracking.c +++ b/tools/perf/tests/switch-tracking.c | |||
@@ -328,7 +328,7 @@ int test__switch_tracking(struct test *test __maybe_unused, int subtest __maybe_ | |||
328 | }, | 328 | }, |
329 | }; | 329 | }; |
330 | struct thread_map *threads = NULL; | 330 | struct thread_map *threads = NULL; |
331 | struct cpu_map *cpus = NULL; | 331 | struct perf_cpu_map *cpus = NULL; |
332 | struct perf_evlist *evlist = NULL; | 332 | struct perf_evlist *evlist = NULL; |
333 | struct perf_evsel *evsel, *cpu_clocks_evsel, *cycles_evsel; | 333 | struct perf_evsel *evsel, *cpu_clocks_evsel, *cycles_evsel; |
334 | struct perf_evsel *switch_evsel, *tracking_evsel; | 334 | struct perf_evsel *switch_evsel, *tracking_evsel; |
diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c index e92fa6029ac7..d66767be4c45 100644 --- a/tools/perf/tests/task-exit.c +++ b/tools/perf/tests/task-exit.c | |||
@@ -45,7 +45,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused | |||
45 | }; | 45 | }; |
46 | const char *argv[] = { "true", NULL }; | 46 | const char *argv[] = { "true", NULL }; |
47 | char sbuf[STRERR_BUFSIZE]; | 47 | char sbuf[STRERR_BUFSIZE]; |
48 | struct cpu_map *cpus; | 48 | struct perf_cpu_map *cpus; |
49 | struct thread_map *threads; | 49 | struct thread_map *threads; |
50 | struct perf_mmap *md; | 50 | struct perf_mmap *md; |
51 | 51 | ||
diff --git a/tools/perf/tests/topology.c b/tools/perf/tests/topology.c index 9497d02f69e6..443d0272ebbd 100644 --- a/tools/perf/tests/topology.c +++ b/tools/perf/tests/topology.c | |||
@@ -57,7 +57,7 @@ static int session_write_header(char *path) | |||
57 | return 0; | 57 | return 0; |
58 | } | 58 | } |
59 | 59 | ||
60 | static int check_cpu_topology(char *path, struct cpu_map *map) | 60 | static int check_cpu_topology(char *path, struct perf_cpu_map *map) |
61 | { | 61 | { |
62 | struct perf_session *session; | 62 | struct perf_session *session; |
63 | struct perf_data data = { | 63 | struct perf_data data = { |
@@ -116,7 +116,7 @@ static int check_cpu_topology(char *path, struct cpu_map *map) | |||
116 | int test__session_topology(struct test *test __maybe_unused, int subtest __maybe_unused) | 116 | int test__session_topology(struct test *test __maybe_unused, int subtest __maybe_unused) |
117 | { | 117 | { |
118 | char path[PATH_MAX]; | 118 | char path[PATH_MAX]; |
119 | struct cpu_map *map; | 119 | struct perf_cpu_map *map; |
120 | int ret = TEST_FAIL; | 120 | int ret = TEST_FAIL; |
121 | 121 | ||
122 | TEST_ASSERT_VAL("can't get templ file", !get_temp(path)); | 122 | TEST_ASSERT_VAL("can't get templ file", !get_temp(path)); |
diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c index 3acfbe34ebaf..5eb4e1fbb877 100644 --- a/tools/perf/util/cpumap.c +++ b/tools/perf/util/cpumap.c | |||
@@ -17,9 +17,9 @@ static int max_present_cpu_num; | |||
17 | static int max_node_num; | 17 | static int max_node_num; |
18 | static int *cpunode_map; | 18 | static int *cpunode_map; |
19 | 19 | ||
20 | static struct cpu_map *cpu_map__default_new(void) | 20 | static struct perf_cpu_map *cpu_map__default_new(void) |
21 | { | 21 | { |
22 | struct cpu_map *cpus; | 22 | struct perf_cpu_map *cpus; |
23 | int nr_cpus; | 23 | int nr_cpus; |
24 | 24 | ||
25 | nr_cpus = sysconf(_SC_NPROCESSORS_ONLN); | 25 | nr_cpus = sysconf(_SC_NPROCESSORS_ONLN); |
@@ -39,10 +39,10 @@ static struct cpu_map *cpu_map__default_new(void) | |||
39 | return cpus; | 39 | return cpus; |
40 | } | 40 | } |
41 | 41 | ||
42 | static struct cpu_map *cpu_map__trim_new(int nr_cpus, int *tmp_cpus) | 42 | static struct perf_cpu_map *cpu_map__trim_new(int nr_cpus, int *tmp_cpus) |
43 | { | 43 | { |
44 | size_t payload_size = nr_cpus * sizeof(int); | 44 | size_t payload_size = nr_cpus * sizeof(int); |
45 | struct cpu_map *cpus = malloc(sizeof(*cpus) + payload_size); | 45 | struct perf_cpu_map *cpus = malloc(sizeof(*cpus) + payload_size); |
46 | 46 | ||
47 | if (cpus != NULL) { | 47 | if (cpus != NULL) { |
48 | cpus->nr = nr_cpus; | 48 | cpus->nr = nr_cpus; |
@@ -53,9 +53,9 @@ static struct cpu_map *cpu_map__trim_new(int nr_cpus, int *tmp_cpus) | |||
53 | return cpus; | 53 | return cpus; |
54 | } | 54 | } |
55 | 55 | ||
56 | struct cpu_map *cpu_map__read(FILE *file) | 56 | struct perf_cpu_map *cpu_map__read(FILE *file) |
57 | { | 57 | { |
58 | struct cpu_map *cpus = NULL; | 58 | struct perf_cpu_map *cpus = NULL; |
59 | int nr_cpus = 0; | 59 | int nr_cpus = 0; |
60 | int *tmp_cpus = NULL, *tmp; | 60 | int *tmp_cpus = NULL, *tmp; |
61 | int max_entries = 0; | 61 | int max_entries = 0; |
@@ -108,9 +108,9 @@ out_free_tmp: | |||
108 | return cpus; | 108 | return cpus; |
109 | } | 109 | } |
110 | 110 | ||
111 | static struct cpu_map *cpu_map__read_all_cpu_map(void) | 111 | static struct perf_cpu_map *cpu_map__read_all_cpu_map(void) |
112 | { | 112 | { |
113 | struct cpu_map *cpus = NULL; | 113 | struct perf_cpu_map *cpus = NULL; |
114 | FILE *onlnf; | 114 | FILE *onlnf; |
115 | 115 | ||
116 | onlnf = fopen("/sys/devices/system/cpu/online", "r"); | 116 | onlnf = fopen("/sys/devices/system/cpu/online", "r"); |
@@ -122,9 +122,9 @@ static struct cpu_map *cpu_map__read_all_cpu_map(void) | |||
122 | return cpus; | 122 | return cpus; |
123 | } | 123 | } |
124 | 124 | ||
125 | struct cpu_map *cpu_map__new(const char *cpu_list) | 125 | struct perf_cpu_map *cpu_map__new(const char *cpu_list) |
126 | { | 126 | { |
127 | struct cpu_map *cpus = NULL; | 127 | struct perf_cpu_map *cpus = NULL; |
128 | unsigned long start_cpu, end_cpu = 0; | 128 | unsigned long start_cpu, end_cpu = 0; |
129 | char *p = NULL; | 129 | char *p = NULL; |
130 | int i, nr_cpus = 0; | 130 | int i, nr_cpus = 0; |
@@ -196,9 +196,9 @@ out: | |||
196 | return cpus; | 196 | return cpus; |
197 | } | 197 | } |
198 | 198 | ||
199 | static struct cpu_map *cpu_map__from_entries(struct cpu_map_entries *cpus) | 199 | static struct perf_cpu_map *cpu_map__from_entries(struct cpu_map_entries *cpus) |
200 | { | 200 | { |
201 | struct cpu_map *map; | 201 | struct perf_cpu_map *map; |
202 | 202 | ||
203 | map = cpu_map__empty_new(cpus->nr); | 203 | map = cpu_map__empty_new(cpus->nr); |
204 | if (map) { | 204 | if (map) { |
@@ -220,9 +220,9 @@ static struct cpu_map *cpu_map__from_entries(struct cpu_map_entries *cpus) | |||
220 | return map; | 220 | return map; |
221 | } | 221 | } |
222 | 222 | ||
223 | static struct cpu_map *cpu_map__from_mask(struct cpu_map_mask *mask) | 223 | static struct perf_cpu_map *cpu_map__from_mask(struct cpu_map_mask *mask) |
224 | { | 224 | { |
225 | struct cpu_map *map; | 225 | struct perf_cpu_map *map; |
226 | int nr, nbits = mask->nr * mask->long_size * BITS_PER_BYTE; | 226 | int nr, nbits = mask->nr * mask->long_size * BITS_PER_BYTE; |
227 | 227 | ||
228 | nr = bitmap_weight(mask->mask, nbits); | 228 | nr = bitmap_weight(mask->mask, nbits); |
@@ -238,7 +238,7 @@ static struct cpu_map *cpu_map__from_mask(struct cpu_map_mask *mask) | |||
238 | 238 | ||
239 | } | 239 | } |
240 | 240 | ||
241 | struct cpu_map *cpu_map__new_data(struct cpu_map_data *data) | 241 | struct perf_cpu_map *cpu_map__new_data(struct cpu_map_data *data) |
242 | { | 242 | { |
243 | if (data->type == PERF_CPU_MAP__CPUS) | 243 | if (data->type == PERF_CPU_MAP__CPUS) |
244 | return cpu_map__from_entries((struct cpu_map_entries *)data->data); | 244 | return cpu_map__from_entries((struct cpu_map_entries *)data->data); |
@@ -246,7 +246,7 @@ struct cpu_map *cpu_map__new_data(struct cpu_map_data *data) | |||
246 | return cpu_map__from_mask((struct cpu_map_mask *)data->data); | 246 | return cpu_map__from_mask((struct cpu_map_mask *)data->data); |
247 | } | 247 | } |
248 | 248 | ||
249 | size_t cpu_map__fprintf(struct cpu_map *map, FILE *fp) | 249 | size_t cpu_map__fprintf(struct perf_cpu_map *map, FILE *fp) |
250 | { | 250 | { |
251 | #define BUFSIZE 1024 | 251 | #define BUFSIZE 1024 |
252 | char buf[BUFSIZE]; | 252 | char buf[BUFSIZE]; |
@@ -256,9 +256,9 @@ size_t cpu_map__fprintf(struct cpu_map *map, FILE *fp) | |||
256 | #undef BUFSIZE | 256 | #undef BUFSIZE |
257 | } | 257 | } |
258 | 258 | ||
259 | struct cpu_map *cpu_map__dummy_new(void) | 259 | struct perf_cpu_map *cpu_map__dummy_new(void) |
260 | { | 260 | { |
261 | struct cpu_map *cpus = malloc(sizeof(*cpus) + sizeof(int)); | 261 | struct perf_cpu_map *cpus = malloc(sizeof(*cpus) + sizeof(int)); |
262 | 262 | ||
263 | if (cpus != NULL) { | 263 | if (cpus != NULL) { |
264 | cpus->nr = 1; | 264 | cpus->nr = 1; |
@@ -269,9 +269,9 @@ struct cpu_map *cpu_map__dummy_new(void) | |||
269 | return cpus; | 269 | return cpus; |
270 | } | 270 | } |
271 | 271 | ||
272 | struct cpu_map *cpu_map__empty_new(int nr) | 272 | struct perf_cpu_map *cpu_map__empty_new(int nr) |
273 | { | 273 | { |
274 | struct cpu_map *cpus = malloc(sizeof(*cpus) + sizeof(int) * nr); | 274 | struct perf_cpu_map *cpus = malloc(sizeof(*cpus) + sizeof(int) * nr); |
275 | 275 | ||
276 | if (cpus != NULL) { | 276 | if (cpus != NULL) { |
277 | int i; | 277 | int i; |
@@ -286,7 +286,7 @@ struct cpu_map *cpu_map__empty_new(int nr) | |||
286 | return cpus; | 286 | return cpus; |
287 | } | 287 | } |
288 | 288 | ||
289 | static void cpu_map__delete(struct cpu_map *map) | 289 | static void cpu_map__delete(struct perf_cpu_map *map) |
290 | { | 290 | { |
291 | if (map) { | 291 | if (map) { |
292 | WARN_ONCE(refcount_read(&map->refcnt) != 0, | 292 | WARN_ONCE(refcount_read(&map->refcnt) != 0, |
@@ -295,14 +295,14 @@ static void cpu_map__delete(struct cpu_map *map) | |||
295 | } | 295 | } |
296 | } | 296 | } |
297 | 297 | ||
298 | struct cpu_map *cpu_map__get(struct cpu_map *map) | 298 | struct perf_cpu_map *cpu_map__get(struct perf_cpu_map *map) |
299 | { | 299 | { |
300 | if (map) | 300 | if (map) |
301 | refcount_inc(&map->refcnt); | 301 | refcount_inc(&map->refcnt); |
302 | return map; | 302 | return map; |
303 | } | 303 | } |
304 | 304 | ||
305 | void cpu_map__put(struct cpu_map *map) | 305 | void cpu_map__put(struct perf_cpu_map *map) |
306 | { | 306 | { |
307 | if (map && refcount_dec_and_test(&map->refcnt)) | 307 | if (map && refcount_dec_and_test(&map->refcnt)) |
308 | cpu_map__delete(map); | 308 | cpu_map__delete(map); |
@@ -324,7 +324,7 @@ int cpu_map__get_socket_id(int cpu) | |||
324 | return ret ?: value; | 324 | return ret ?: value; |
325 | } | 325 | } |
326 | 326 | ||
327 | int cpu_map__get_socket(struct cpu_map *map, int idx, void *data __maybe_unused) | 327 | int cpu_map__get_socket(struct perf_cpu_map *map, int idx, void *data __maybe_unused) |
328 | { | 328 | { |
329 | int cpu; | 329 | int cpu; |
330 | 330 | ||
@@ -341,11 +341,11 @@ static int cmp_ids(const void *a, const void *b) | |||
341 | return *(int *)a - *(int *)b; | 341 | return *(int *)a - *(int *)b; |
342 | } | 342 | } |
343 | 343 | ||
344 | int cpu_map__build_map(struct cpu_map *cpus, struct cpu_map **res, | 344 | int cpu_map__build_map(struct perf_cpu_map *cpus, struct perf_cpu_map **res, |
345 | int (*f)(struct cpu_map *map, int cpu, void *data), | 345 | int (*f)(struct perf_cpu_map *map, int cpu, void *data), |
346 | void *data) | 346 | void *data) |
347 | { | 347 | { |
348 | struct cpu_map *c; | 348 | struct perf_cpu_map *c; |
349 | int nr = cpus->nr; | 349 | int nr = cpus->nr; |
350 | int cpu, s1, s2; | 350 | int cpu, s1, s2; |
351 | 351 | ||
@@ -380,7 +380,7 @@ int cpu_map__get_die_id(int cpu) | |||
380 | return ret ?: value; | 380 | return ret ?: value; |
381 | } | 381 | } |
382 | 382 | ||
383 | int cpu_map__get_die(struct cpu_map *map, int idx, void *data) | 383 | int cpu_map__get_die(struct perf_cpu_map *map, int idx, void *data) |
384 | { | 384 | { |
385 | int cpu, die_id, s; | 385 | int cpu, die_id, s; |
386 | 386 | ||
@@ -419,7 +419,7 @@ int cpu_map__get_core_id(int cpu) | |||
419 | return ret ?: value; | 419 | return ret ?: value; |
420 | } | 420 | } |
421 | 421 | ||
422 | int cpu_map__get_core(struct cpu_map *map, int idx, void *data) | 422 | int cpu_map__get_core(struct perf_cpu_map *map, int idx, void *data) |
423 | { | 423 | { |
424 | int cpu, s_die; | 424 | int cpu, s_die; |
425 | 425 | ||
@@ -448,17 +448,17 @@ int cpu_map__get_core(struct cpu_map *map, int idx, void *data) | |||
448 | return (s_die << 16) | (cpu & 0xffff); | 448 | return (s_die << 16) | (cpu & 0xffff); |
449 | } | 449 | } |
450 | 450 | ||
451 | int cpu_map__build_socket_map(struct cpu_map *cpus, struct cpu_map **sockp) | 451 | int cpu_map__build_socket_map(struct perf_cpu_map *cpus, struct perf_cpu_map **sockp) |
452 | { | 452 | { |
453 | return cpu_map__build_map(cpus, sockp, cpu_map__get_socket, NULL); | 453 | return cpu_map__build_map(cpus, sockp, cpu_map__get_socket, NULL); |
454 | } | 454 | } |
455 | 455 | ||
456 | int cpu_map__build_die_map(struct cpu_map *cpus, struct cpu_map **diep) | 456 | int cpu_map__build_die_map(struct perf_cpu_map *cpus, struct perf_cpu_map **diep) |
457 | { | 457 | { |
458 | return cpu_map__build_map(cpus, diep, cpu_map__get_die, NULL); | 458 | return cpu_map__build_map(cpus, diep, cpu_map__get_die, NULL); |
459 | } | 459 | } |
460 | 460 | ||
461 | int cpu_map__build_core_map(struct cpu_map *cpus, struct cpu_map **corep) | 461 | int cpu_map__build_core_map(struct perf_cpu_map *cpus, struct perf_cpu_map **corep) |
462 | { | 462 | { |
463 | return cpu_map__build_map(cpus, corep, cpu_map__get_core, NULL); | 463 | return cpu_map__build_map(cpus, corep, cpu_map__get_core, NULL); |
464 | } | 464 | } |
@@ -670,12 +670,12 @@ int cpu__setup_cpunode_map(void) | |||
670 | return 0; | 670 | return 0; |
671 | } | 671 | } |
672 | 672 | ||
673 | bool cpu_map__has(struct cpu_map *cpus, int cpu) | 673 | bool cpu_map__has(struct perf_cpu_map *cpus, int cpu) |
674 | { | 674 | { |
675 | return cpu_map__idx(cpus, cpu) != -1; | 675 | return cpu_map__idx(cpus, cpu) != -1; |
676 | } | 676 | } |
677 | 677 | ||
678 | int cpu_map__idx(struct cpu_map *cpus, int cpu) | 678 | int cpu_map__idx(struct perf_cpu_map *cpus, int cpu) |
679 | { | 679 | { |
680 | int i; | 680 | int i; |
681 | 681 | ||
@@ -687,12 +687,12 @@ int cpu_map__idx(struct cpu_map *cpus, int cpu) | |||
687 | return -1; | 687 | return -1; |
688 | } | 688 | } |
689 | 689 | ||
690 | int cpu_map__cpu(struct cpu_map *cpus, int idx) | 690 | int cpu_map__cpu(struct perf_cpu_map *cpus, int idx) |
691 | { | 691 | { |
692 | return cpus->map[idx]; | 692 | return cpus->map[idx]; |
693 | } | 693 | } |
694 | 694 | ||
695 | size_t cpu_map__snprint(struct cpu_map *map, char *buf, size_t size) | 695 | size_t cpu_map__snprint(struct perf_cpu_map *map, char *buf, size_t size) |
696 | { | 696 | { |
697 | int i, cpu, start = -1; | 697 | int i, cpu, start = -1; |
698 | bool first = true; | 698 | bool first = true; |
@@ -744,7 +744,7 @@ static char hex_char(unsigned char val) | |||
744 | return '?'; | 744 | return '?'; |
745 | } | 745 | } |
746 | 746 | ||
747 | size_t cpu_map__snprint_mask(struct cpu_map *map, char *buf, size_t size) | 747 | size_t cpu_map__snprint_mask(struct perf_cpu_map *map, char *buf, size_t size) |
748 | { | 748 | { |
749 | int i, cpu; | 749 | int i, cpu; |
750 | char *ptr = buf; | 750 | char *ptr = buf; |
@@ -781,9 +781,9 @@ size_t cpu_map__snprint_mask(struct cpu_map *map, char *buf, size_t size) | |||
781 | return ptr - buf; | 781 | return ptr - buf; |
782 | } | 782 | } |
783 | 783 | ||
784 | const struct cpu_map *cpu_map__online(void) /* thread unsafe */ | 784 | const struct perf_cpu_map *cpu_map__online(void) /* thread unsafe */ |
785 | { | 785 | { |
786 | static const struct cpu_map *online = NULL; | 786 | static const struct perf_cpu_map *online = NULL; |
787 | 787 | ||
788 | if (!online) | 788 | if (!online) |
789 | online = cpu_map__new(NULL); /* from /sys/devices/system/cpu/online */ | 789 | online = cpu_map__new(NULL); /* from /sys/devices/system/cpu/online */ |
diff --git a/tools/perf/util/cpumap.h b/tools/perf/util/cpumap.h index 1265f0e33920..22729beae959 100644 --- a/tools/perf/util/cpumap.h +++ b/tools/perf/util/cpumap.h | |||
@@ -9,35 +9,35 @@ | |||
9 | #include "perf.h" | 9 | #include "perf.h" |
10 | #include "util/debug.h" | 10 | #include "util/debug.h" |
11 | 11 | ||
12 | struct cpu_map { | 12 | struct perf_cpu_map { |
13 | refcount_t refcnt; | 13 | refcount_t refcnt; |
14 | int nr; | 14 | int nr; |
15 | int map[]; | 15 | int map[]; |
16 | }; | 16 | }; |
17 | 17 | ||
18 | struct cpu_map *cpu_map__new(const char *cpu_list); | 18 | struct perf_cpu_map *cpu_map__new(const char *cpu_list); |
19 | struct cpu_map *cpu_map__empty_new(int nr); | 19 | struct perf_cpu_map *cpu_map__empty_new(int nr); |
20 | struct cpu_map *cpu_map__dummy_new(void); | 20 | struct perf_cpu_map *cpu_map__dummy_new(void); |
21 | struct cpu_map *cpu_map__new_data(struct cpu_map_data *data); | 21 | struct perf_cpu_map *cpu_map__new_data(struct cpu_map_data *data); |
22 | struct cpu_map *cpu_map__read(FILE *file); | 22 | struct perf_cpu_map *cpu_map__read(FILE *file); |
23 | size_t cpu_map__snprint(struct cpu_map *map, char *buf, size_t size); | 23 | size_t cpu_map__snprint(struct perf_cpu_map *map, char *buf, size_t size); |
24 | size_t cpu_map__snprint_mask(struct cpu_map *map, char *buf, size_t size); | 24 | size_t cpu_map__snprint_mask(struct perf_cpu_map *map, char *buf, size_t size); |
25 | size_t cpu_map__fprintf(struct cpu_map *map, FILE *fp); | 25 | size_t cpu_map__fprintf(struct perf_cpu_map *map, FILE *fp); |
26 | int cpu_map__get_socket_id(int cpu); | 26 | int cpu_map__get_socket_id(int cpu); |
27 | int cpu_map__get_socket(struct cpu_map *map, int idx, void *data); | 27 | int cpu_map__get_socket(struct perf_cpu_map *map, int idx, void *data); |
28 | int cpu_map__get_die_id(int cpu); | 28 | int cpu_map__get_die_id(int cpu); |
29 | int cpu_map__get_die(struct cpu_map *map, int idx, void *data); | 29 | int cpu_map__get_die(struct perf_cpu_map *map, int idx, void *data); |
30 | int cpu_map__get_core_id(int cpu); | 30 | int cpu_map__get_core_id(int cpu); |
31 | int cpu_map__get_core(struct cpu_map *map, int idx, void *data); | 31 | int cpu_map__get_core(struct perf_cpu_map *map, int idx, void *data); |
32 | int cpu_map__build_socket_map(struct cpu_map *cpus, struct cpu_map **sockp); | 32 | int cpu_map__build_socket_map(struct perf_cpu_map *cpus, struct perf_cpu_map **sockp); |
33 | int cpu_map__build_die_map(struct cpu_map *cpus, struct cpu_map **diep); | 33 | int cpu_map__build_die_map(struct perf_cpu_map *cpus, struct perf_cpu_map **diep); |
34 | int cpu_map__build_core_map(struct cpu_map *cpus, struct cpu_map **corep); | 34 | int cpu_map__build_core_map(struct perf_cpu_map *cpus, struct perf_cpu_map **corep); |
35 | const struct cpu_map *cpu_map__online(void); /* thread unsafe */ | 35 | const struct perf_cpu_map *cpu_map__online(void); /* thread unsafe */ |
36 | 36 | ||
37 | struct cpu_map *cpu_map__get(struct cpu_map *map); | 37 | struct perf_cpu_map *cpu_map__get(struct perf_cpu_map *map); |
38 | void cpu_map__put(struct cpu_map *map); | 38 | void cpu_map__put(struct perf_cpu_map *map); |
39 | 39 | ||
40 | static inline int cpu_map__socket(struct cpu_map *sock, int s) | 40 | static inline int cpu_map__socket(struct perf_cpu_map *sock, int s) |
41 | { | 41 | { |
42 | if (!sock || s > sock->nr || s < 0) | 42 | if (!sock || s > sock->nr || s < 0) |
43 | return 0; | 43 | return 0; |
@@ -59,12 +59,12 @@ static inline int cpu_map__id_to_cpu(int id) | |||
59 | return id & 0xffff; | 59 | return id & 0xffff; |
60 | } | 60 | } |
61 | 61 | ||
62 | static inline int cpu_map__nr(const struct cpu_map *map) | 62 | static inline int cpu_map__nr(const struct perf_cpu_map *map) |
63 | { | 63 | { |
64 | return map ? map->nr : 1; | 64 | return map ? map->nr : 1; |
65 | } | 65 | } |
66 | 66 | ||
67 | static inline bool cpu_map__empty(const struct cpu_map *map) | 67 | static inline bool cpu_map__empty(const struct perf_cpu_map *map) |
68 | { | 68 | { |
69 | return map ? map->map[0] == -1 : true; | 69 | return map ? map->map[0] == -1 : true; |
70 | } | 70 | } |
@@ -76,11 +76,11 @@ int cpu__max_cpu(void); | |||
76 | int cpu__max_present_cpu(void); | 76 | int cpu__max_present_cpu(void); |
77 | int cpu__get_node(int cpu); | 77 | int cpu__get_node(int cpu); |
78 | 78 | ||
79 | int cpu_map__build_map(struct cpu_map *cpus, struct cpu_map **res, | 79 | int cpu_map__build_map(struct perf_cpu_map *cpus, struct perf_cpu_map **res, |
80 | int (*f)(struct cpu_map *map, int cpu, void *data), | 80 | int (*f)(struct perf_cpu_map *map, int cpu, void *data), |
81 | void *data); | 81 | void *data); |
82 | 82 | ||
83 | int cpu_map__cpu(struct cpu_map *cpus, int idx); | 83 | int cpu_map__cpu(struct perf_cpu_map *cpus, int idx); |
84 | bool cpu_map__has(struct cpu_map *cpus, int cpu); | 84 | bool cpu_map__has(struct perf_cpu_map *cpus, int cpu); |
85 | int cpu_map__idx(struct cpu_map *cpus, int cpu); | 85 | int cpu_map__idx(struct perf_cpu_map *cpus, int cpu); |
86 | #endif /* __PERF_CPUMAP_H */ | 86 | #endif /* __PERF_CPUMAP_H */ |
diff --git a/tools/perf/util/cputopo.c b/tools/perf/util/cputopo.c index 64336a280967..157b0988435e 100644 --- a/tools/perf/util/cputopo.c +++ b/tools/perf/util/cputopo.c | |||
@@ -176,7 +176,7 @@ struct cpu_topology *cpu_topology__new(void) | |||
176 | size_t sz; | 176 | size_t sz; |
177 | long ncpus; | 177 | long ncpus; |
178 | int ret = -1; | 178 | int ret = -1; |
179 | struct cpu_map *map; | 179 | struct perf_cpu_map *map; |
180 | bool has_die = has_die_topology(); | 180 | bool has_die = has_die_topology(); |
181 | 181 | ||
182 | ncpus = cpu__max_present_cpu(); | 182 | ncpus = cpu__max_present_cpu(); |
@@ -289,7 +289,7 @@ err: | |||
289 | 289 | ||
290 | struct numa_topology *numa_topology__new(void) | 290 | struct numa_topology *numa_topology__new(void) |
291 | { | 291 | { |
292 | struct cpu_map *node_map = NULL; | 292 | struct perf_cpu_map *node_map = NULL; |
293 | struct numa_topology *tp = NULL; | 293 | struct numa_topology *tp = NULL; |
294 | char path[MAXPATHLEN]; | 294 | char path[MAXPATHLEN]; |
295 | char *buf = NULL; | 295 | char *buf = NULL; |
diff --git a/tools/perf/util/env.h b/tools/perf/util/env.h index d5d9865aa812..d8e083d42610 100644 --- a/tools/perf/util/env.h +++ b/tools/perf/util/env.h | |||
@@ -27,7 +27,7 @@ struct numa_node { | |||
27 | u32 node; | 27 | u32 node; |
28 | u64 mem_total; | 28 | u64 mem_total; |
29 | u64 mem_free; | 29 | u64 mem_free; |
30 | struct cpu_map *map; | 30 | struct perf_cpu_map *map; |
31 | }; | 31 | }; |
32 | 32 | ||
33 | struct memory_node { | 33 | struct memory_node { |
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index f1f4848947ce..406ad8772907 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -1008,7 +1008,7 @@ int perf_event__synthesize_thread_map2(struct perf_tool *tool, | |||
1008 | } | 1008 | } |
1009 | 1009 | ||
1010 | static void synthesize_cpus(struct cpu_map_entries *cpus, | 1010 | static void synthesize_cpus(struct cpu_map_entries *cpus, |
1011 | struct cpu_map *map) | 1011 | struct perf_cpu_map *map) |
1012 | { | 1012 | { |
1013 | int i; | 1013 | int i; |
1014 | 1014 | ||
@@ -1019,7 +1019,7 @@ static void synthesize_cpus(struct cpu_map_entries *cpus, | |||
1019 | } | 1019 | } |
1020 | 1020 | ||
1021 | static void synthesize_mask(struct cpu_map_mask *mask, | 1021 | static void synthesize_mask(struct cpu_map_mask *mask, |
1022 | struct cpu_map *map, int max) | 1022 | struct perf_cpu_map *map, int max) |
1023 | { | 1023 | { |
1024 | int i; | 1024 | int i; |
1025 | 1025 | ||
@@ -1030,12 +1030,12 @@ static void synthesize_mask(struct cpu_map_mask *mask, | |||
1030 | set_bit(map->map[i], mask->mask); | 1030 | set_bit(map->map[i], mask->mask); |
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | static size_t cpus_size(struct cpu_map *map) | 1033 | static size_t cpus_size(struct perf_cpu_map *map) |
1034 | { | 1034 | { |
1035 | return sizeof(struct cpu_map_entries) + map->nr * sizeof(u16); | 1035 | return sizeof(struct cpu_map_entries) + map->nr * sizeof(u16); |
1036 | } | 1036 | } |
1037 | 1037 | ||
1038 | static size_t mask_size(struct cpu_map *map, int *max) | 1038 | static size_t mask_size(struct perf_cpu_map *map, int *max) |
1039 | { | 1039 | { |
1040 | int i; | 1040 | int i; |
1041 | 1041 | ||
@@ -1052,7 +1052,7 @@ static size_t mask_size(struct cpu_map *map, int *max) | |||
1052 | return sizeof(struct cpu_map_mask) + BITS_TO_LONGS(*max) * sizeof(long); | 1052 | return sizeof(struct cpu_map_mask) + BITS_TO_LONGS(*max) * sizeof(long); |
1053 | } | 1053 | } |
1054 | 1054 | ||
1055 | void *cpu_map_data__alloc(struct cpu_map *map, size_t *size, u16 *type, int *max) | 1055 | void *cpu_map_data__alloc(struct perf_cpu_map *map, size_t *size, u16 *type, int *max) |
1056 | { | 1056 | { |
1057 | size_t size_cpus, size_mask; | 1057 | size_t size_cpus, size_mask; |
1058 | bool is_dummy = cpu_map__empty(map); | 1058 | bool is_dummy = cpu_map__empty(map); |
@@ -1086,7 +1086,7 @@ void *cpu_map_data__alloc(struct cpu_map *map, size_t *size, u16 *type, int *max | |||
1086 | return zalloc(*size); | 1086 | return zalloc(*size); |
1087 | } | 1087 | } |
1088 | 1088 | ||
1089 | void cpu_map_data__synthesize(struct cpu_map_data *data, struct cpu_map *map, | 1089 | void cpu_map_data__synthesize(struct cpu_map_data *data, struct perf_cpu_map *map, |
1090 | u16 type, int max) | 1090 | u16 type, int max) |
1091 | { | 1091 | { |
1092 | data->type = type; | 1092 | data->type = type; |
@@ -1102,7 +1102,7 @@ void cpu_map_data__synthesize(struct cpu_map_data *data, struct cpu_map *map, | |||
1102 | }; | 1102 | }; |
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | static struct cpu_map_event* cpu_map_event__new(struct cpu_map *map) | 1105 | static struct cpu_map_event* cpu_map_event__new(struct perf_cpu_map *map) |
1106 | { | 1106 | { |
1107 | size_t size = sizeof(struct cpu_map_event); | 1107 | size_t size = sizeof(struct cpu_map_event); |
1108 | struct cpu_map_event *event; | 1108 | struct cpu_map_event *event; |
@@ -1122,7 +1122,7 @@ static struct cpu_map_event* cpu_map_event__new(struct cpu_map *map) | |||
1122 | } | 1122 | } |
1123 | 1123 | ||
1124 | int perf_event__synthesize_cpu_map(struct perf_tool *tool, | 1124 | int perf_event__synthesize_cpu_map(struct perf_tool *tool, |
1125 | struct cpu_map *map, | 1125 | struct perf_cpu_map *map, |
1126 | perf_event__handler_t process, | 1126 | perf_event__handler_t process, |
1127 | struct machine *machine) | 1127 | struct machine *machine) |
1128 | { | 1128 | { |
@@ -1393,7 +1393,7 @@ size_t perf_event__fprintf_thread_map(union perf_event *event, FILE *fp) | |||
1393 | 1393 | ||
1394 | size_t perf_event__fprintf_cpu_map(union perf_event *event, FILE *fp) | 1394 | size_t perf_event__fprintf_cpu_map(union perf_event *event, FILE *fp) |
1395 | { | 1395 | { |
1396 | struct cpu_map *cpus = cpu_map__new_data(&event->cpu_map.data); | 1396 | struct perf_cpu_map *cpus = cpu_map__new_data(&event->cpu_map.data); |
1397 | size_t ret; | 1397 | size_t ret; |
1398 | 1398 | ||
1399 | ret = fprintf(fp, ": "); | 1399 | ret = fprintf(fp, ": "); |
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index 1f1da6082806..cafaac5128ab 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h | |||
@@ -675,7 +675,7 @@ void perf_event__print_totals(void); | |||
675 | 675 | ||
676 | struct perf_tool; | 676 | struct perf_tool; |
677 | struct thread_map; | 677 | struct thread_map; |
678 | struct cpu_map; | 678 | struct perf_cpu_map; |
679 | struct perf_stat_config; | 679 | struct perf_stat_config; |
680 | struct perf_counts_values; | 680 | struct perf_counts_values; |
681 | 681 | ||
@@ -693,7 +693,7 @@ int perf_event__synthesize_thread_map2(struct perf_tool *tool, | |||
693 | perf_event__handler_t process, | 693 | perf_event__handler_t process, |
694 | struct machine *machine); | 694 | struct machine *machine); |
695 | int perf_event__synthesize_cpu_map(struct perf_tool *tool, | 695 | int perf_event__synthesize_cpu_map(struct perf_tool *tool, |
696 | struct cpu_map *cpus, | 696 | struct perf_cpu_map *cpus, |
697 | perf_event__handler_t process, | 697 | perf_event__handler_t process, |
698 | struct machine *machine); | 698 | struct machine *machine); |
699 | int perf_event__synthesize_threads(struct perf_tool *tool, | 699 | int perf_event__synthesize_threads(struct perf_tool *tool, |
@@ -844,8 +844,8 @@ size_t perf_event__fprintf(union perf_event *event, FILE *fp); | |||
844 | int kallsyms__get_function_start(const char *kallsyms_filename, | 844 | int kallsyms__get_function_start(const char *kallsyms_filename, |
845 | const char *symbol_name, u64 *addr); | 845 | const char *symbol_name, u64 *addr); |
846 | 846 | ||
847 | void *cpu_map_data__alloc(struct cpu_map *map, size_t *size, u16 *type, int *max); | 847 | void *cpu_map_data__alloc(struct perf_cpu_map *map, size_t *size, u16 *type, int *max); |
848 | void cpu_map_data__synthesize(struct cpu_map_data *data, struct cpu_map *map, | 848 | void cpu_map_data__synthesize(struct cpu_map_data *data, struct perf_cpu_map *map, |
849 | u16 type, int max); | 849 | u16 type, int max); |
850 | 850 | ||
851 | void event_attr_init(struct perf_event_attr *attr); | 851 | void event_attr_init(struct perf_event_attr *attr); |
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index b0364d923f76..bce883eaf0dc 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -41,7 +41,7 @@ int sigqueue(pid_t pid, int sig, const union sigval value); | |||
41 | #define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y)) | 41 | #define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y)) |
42 | #define SID(e, x, y) xyarray__entry(e->sample_id, x, y) | 42 | #define SID(e, x, y) xyarray__entry(e->sample_id, x, y) |
43 | 43 | ||
44 | void perf_evlist__init(struct perf_evlist *evlist, struct cpu_map *cpus, | 44 | void perf_evlist__init(struct perf_evlist *evlist, struct perf_cpu_map *cpus, |
45 | struct thread_map *threads) | 45 | struct thread_map *threads) |
46 | { | 46 | { |
47 | int i; | 47 | int i; |
@@ -1012,7 +1012,7 @@ int perf_evlist__mmap_ex(struct perf_evlist *evlist, unsigned int pages, | |||
1012 | int comp_level) | 1012 | int comp_level) |
1013 | { | 1013 | { |
1014 | struct perf_evsel *evsel; | 1014 | struct perf_evsel *evsel; |
1015 | const struct cpu_map *cpus = evlist->cpus; | 1015 | const struct perf_cpu_map *cpus = evlist->cpus; |
1016 | const struct thread_map *threads = evlist->threads; | 1016 | const struct thread_map *threads = evlist->threads; |
1017 | /* | 1017 | /* |
1018 | * Delay setting mp.prot: set it before calling perf_mmap__mmap. | 1018 | * Delay setting mp.prot: set it before calling perf_mmap__mmap. |
@@ -1058,7 +1058,7 @@ int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages) | |||
1058 | int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target) | 1058 | int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target) |
1059 | { | 1059 | { |
1060 | bool all_threads = (target->per_thread && target->system_wide); | 1060 | bool all_threads = (target->per_thread && target->system_wide); |
1061 | struct cpu_map *cpus; | 1061 | struct perf_cpu_map *cpus; |
1062 | struct thread_map *threads; | 1062 | struct thread_map *threads; |
1063 | 1063 | ||
1064 | /* | 1064 | /* |
@@ -1104,7 +1104,7 @@ out_delete_threads: | |||
1104 | return -1; | 1104 | return -1; |
1105 | } | 1105 | } |
1106 | 1106 | ||
1107 | void perf_evlist__set_maps(struct perf_evlist *evlist, struct cpu_map *cpus, | 1107 | void perf_evlist__set_maps(struct perf_evlist *evlist, struct perf_cpu_map *cpus, |
1108 | struct thread_map *threads) | 1108 | struct thread_map *threads) |
1109 | { | 1109 | { |
1110 | /* | 1110 | /* |
@@ -1358,7 +1358,7 @@ void perf_evlist__close(struct perf_evlist *evlist) | |||
1358 | 1358 | ||
1359 | static int perf_evlist__create_syswide_maps(struct perf_evlist *evlist) | 1359 | static int perf_evlist__create_syswide_maps(struct perf_evlist *evlist) |
1360 | { | 1360 | { |
1361 | struct cpu_map *cpus; | 1361 | struct perf_cpu_map *cpus; |
1362 | struct thread_map *threads; | 1362 | struct thread_map *threads; |
1363 | int err = -ENOMEM; | 1363 | int err = -ENOMEM; |
1364 | 1364 | ||
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h index 49354fe24d5f..c8cda300b584 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h | |||
@@ -18,7 +18,7 @@ | |||
18 | 18 | ||
19 | struct pollfd; | 19 | struct pollfd; |
20 | struct thread_map; | 20 | struct thread_map; |
21 | struct cpu_map; | 21 | struct perf_cpu_map; |
22 | struct record_opts; | 22 | struct record_opts; |
23 | 23 | ||
24 | #define PERF_EVLIST__HLIST_BITS 8 | 24 | #define PERF_EVLIST__HLIST_BITS 8 |
@@ -45,7 +45,7 @@ struct perf_evlist { | |||
45 | struct perf_mmap *mmap; | 45 | struct perf_mmap *mmap; |
46 | struct perf_mmap *overwrite_mmap; | 46 | struct perf_mmap *overwrite_mmap; |
47 | struct thread_map *threads; | 47 | struct thread_map *threads; |
48 | struct cpu_map *cpus; | 48 | struct perf_cpu_map *cpus; |
49 | struct perf_evsel *selected; | 49 | struct perf_evsel *selected; |
50 | struct events_stats stats; | 50 | struct events_stats stats; |
51 | struct perf_env *env; | 51 | struct perf_env *env; |
@@ -68,7 +68,7 @@ struct perf_evsel_str_handler { | |||
68 | struct perf_evlist *perf_evlist__new(void); | 68 | struct perf_evlist *perf_evlist__new(void); |
69 | struct perf_evlist *perf_evlist__new_default(void); | 69 | struct perf_evlist *perf_evlist__new_default(void); |
70 | struct perf_evlist *perf_evlist__new_dummy(void); | 70 | struct perf_evlist *perf_evlist__new_dummy(void); |
71 | void perf_evlist__init(struct perf_evlist *evlist, struct cpu_map *cpus, | 71 | void perf_evlist__init(struct perf_evlist *evlist, struct perf_cpu_map *cpus, |
72 | struct thread_map *threads); | 72 | struct thread_map *threads); |
73 | void perf_evlist__exit(struct perf_evlist *evlist); | 73 | void perf_evlist__exit(struct perf_evlist *evlist); |
74 | void perf_evlist__delete(struct perf_evlist *evlist); | 74 | void perf_evlist__delete(struct perf_evlist *evlist); |
@@ -194,7 +194,7 @@ int perf_evlist__enable_event_idx(struct perf_evlist *evlist, | |||
194 | void perf_evlist__set_selected(struct perf_evlist *evlist, | 194 | void perf_evlist__set_selected(struct perf_evlist *evlist, |
195 | struct perf_evsel *evsel); | 195 | struct perf_evsel *evsel); |
196 | 196 | ||
197 | void perf_evlist__set_maps(struct perf_evlist *evlist, struct cpu_map *cpus, | 197 | void perf_evlist__set_maps(struct perf_evlist *evlist, struct perf_cpu_map *cpus, |
198 | struct thread_map *threads); | 198 | struct thread_map *threads); |
199 | int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target); | 199 | int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target); |
200 | int perf_evlist__apply_filters(struct perf_evlist *evlist, struct perf_evsel **err_evsel); | 200 | int perf_evlist__apply_filters(struct perf_evlist *evlist, struct perf_evsel **err_evsel); |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index d23b9574f793..958206c538c3 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -1825,7 +1825,7 @@ static int perf_event_open(struct perf_evsel *evsel, | |||
1825 | return fd; | 1825 | return fd; |
1826 | } | 1826 | } |
1827 | 1827 | ||
1828 | int perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus, | 1828 | int perf_evsel__open(struct perf_evsel *evsel, struct perf_cpu_map *cpus, |
1829 | struct thread_map *threads) | 1829 | struct thread_map *threads) |
1830 | { | 1830 | { |
1831 | int cpu, thread, nthreads; | 1831 | int cpu, thread, nthreads; |
@@ -1837,7 +1837,7 @@ int perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus, | |||
1837 | return -EINVAL; | 1837 | return -EINVAL; |
1838 | 1838 | ||
1839 | if (cpus == NULL) { | 1839 | if (cpus == NULL) { |
1840 | static struct cpu_map *empty_cpu_map; | 1840 | static struct perf_cpu_map *empty_cpu_map; |
1841 | 1841 | ||
1842 | if (empty_cpu_map == NULL) { | 1842 | if (empty_cpu_map == NULL) { |
1843 | empty_cpu_map = cpu_map__dummy_new(); | 1843 | empty_cpu_map = cpu_map__dummy_new(); |
@@ -2084,7 +2084,7 @@ void perf_evsel__close(struct perf_evsel *evsel) | |||
2084 | } | 2084 | } |
2085 | 2085 | ||
2086 | int perf_evsel__open_per_cpu(struct perf_evsel *evsel, | 2086 | int perf_evsel__open_per_cpu(struct perf_evsel *evsel, |
2087 | struct cpu_map *cpus) | 2087 | struct perf_cpu_map *cpus) |
2088 | { | 2088 | { |
2089 | return perf_evsel__open(evsel, cpus, NULL); | 2089 | return perf_evsel__open(evsel, cpus, NULL); |
2090 | } | 2090 | } |
@@ -3064,7 +3064,7 @@ static int store_evsel_ids(struct perf_evsel *evsel, struct perf_evlist *evlist) | |||
3064 | 3064 | ||
3065 | int perf_evsel__store_ids(struct perf_evsel *evsel, struct perf_evlist *evlist) | 3065 | int perf_evsel__store_ids(struct perf_evsel *evsel, struct perf_evlist *evlist) |
3066 | { | 3066 | { |
3067 | struct cpu_map *cpus = evsel->cpus; | 3067 | struct perf_cpu_map *cpus = evsel->cpus; |
3068 | struct thread_map *threads = evsel->threads; | 3068 | struct thread_map *threads = evsel->threads; |
3069 | 3069 | ||
3070 | if (perf_evsel__alloc_id(evsel, cpus->nr, threads->nr)) | 3070 | if (perf_evsel__alloc_id(evsel, cpus->nr, threads->nr)) |
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index b27935a6d36c..76b14037f260 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h | |||
@@ -124,8 +124,8 @@ struct perf_evsel { | |||
124 | u64 db_id; | 124 | u64 db_id; |
125 | struct cgroup *cgrp; | 125 | struct cgroup *cgrp; |
126 | void *handler; | 126 | void *handler; |
127 | struct cpu_map *cpus; | 127 | struct perf_cpu_map *cpus; |
128 | struct cpu_map *own_cpus; | 128 | struct perf_cpu_map *own_cpus; |
129 | struct thread_map *threads; | 129 | struct thread_map *threads; |
130 | unsigned int sample_size; | 130 | unsigned int sample_size; |
131 | int id_pos; | 131 | int id_pos; |
@@ -192,12 +192,12 @@ struct perf_missing_features { | |||
192 | 192 | ||
193 | extern struct perf_missing_features perf_missing_features; | 193 | extern struct perf_missing_features perf_missing_features; |
194 | 194 | ||
195 | struct cpu_map; | 195 | struct perf_cpu_map; |
196 | struct target; | 196 | struct target; |
197 | struct thread_map; | 197 | struct thread_map; |
198 | struct record_opts; | 198 | struct record_opts; |
199 | 199 | ||
200 | static inline struct cpu_map *perf_evsel__cpus(struct perf_evsel *evsel) | 200 | static inline struct perf_cpu_map *perf_evsel__cpus(struct perf_evsel *evsel) |
201 | { | 201 | { |
202 | return evsel->cpus; | 202 | return evsel->cpus; |
203 | } | 203 | } |
@@ -300,10 +300,10 @@ int perf_evsel__enable(struct perf_evsel *evsel); | |||
300 | int perf_evsel__disable(struct perf_evsel *evsel); | 300 | int perf_evsel__disable(struct perf_evsel *evsel); |
301 | 301 | ||
302 | int perf_evsel__open_per_cpu(struct perf_evsel *evsel, | 302 | int perf_evsel__open_per_cpu(struct perf_evsel *evsel, |
303 | struct cpu_map *cpus); | 303 | struct perf_cpu_map *cpus); |
304 | int perf_evsel__open_per_thread(struct perf_evsel *evsel, | 304 | int perf_evsel__open_per_thread(struct perf_evsel *evsel, |
305 | struct thread_map *threads); | 305 | struct thread_map *threads); |
306 | int perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus, | 306 | int perf_evsel__open(struct perf_evsel *evsel, struct perf_cpu_map *cpus, |
307 | struct thread_map *threads); | 307 | struct thread_map *threads); |
308 | void perf_evsel__close(struct perf_evsel *evsel); | 308 | void perf_evsel__close(struct perf_evsel *evsel); |
309 | 309 | ||
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 1903d7ec9797..4be216f3598b 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -3886,7 +3886,7 @@ size_t perf_event__fprintf_event_update(union perf_event *event, FILE *fp) | |||
3886 | struct event_update_event *ev = &event->event_update; | 3886 | struct event_update_event *ev = &event->event_update; |
3887 | struct event_update_event_scale *ev_scale; | 3887 | struct event_update_event_scale *ev_scale; |
3888 | struct event_update_event_cpus *ev_cpus; | 3888 | struct event_update_event_cpus *ev_cpus; |
3889 | struct cpu_map *map; | 3889 | struct perf_cpu_map *map; |
3890 | size_t ret; | 3890 | size_t ret; |
3891 | 3891 | ||
3892 | ret = fprintf(fp, "\n... id: %" PRIu64 "\n", ev->id); | 3892 | ret = fprintf(fp, "\n... id: %" PRIu64 "\n", ev->id); |
@@ -4054,7 +4054,7 @@ int perf_event__process_event_update(struct perf_tool *tool __maybe_unused, | |||
4054 | struct event_update_event_cpus *ev_cpus; | 4054 | struct event_update_event_cpus *ev_cpus; |
4055 | struct perf_evlist *evlist; | 4055 | struct perf_evlist *evlist; |
4056 | struct perf_evsel *evsel; | 4056 | struct perf_evsel *evsel; |
4057 | struct cpu_map *map; | 4057 | struct perf_cpu_map *map; |
4058 | 4058 | ||
4059 | if (!pevlist || *pevlist == NULL) | 4059 | if (!pevlist || *pevlist == NULL) |
4060 | return -EINVAL; | 4060 | return -EINVAL; |
diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c index 9f0b6391af33..177c41fc9842 100644 --- a/tools/perf/util/mmap.c +++ b/tools/perf/util/mmap.c | |||
@@ -325,7 +325,7 @@ void perf_mmap__munmap(struct perf_mmap *map) | |||
325 | static void build_node_mask(int node, cpu_set_t *mask) | 325 | static void build_node_mask(int node, cpu_set_t *mask) |
326 | { | 326 | { |
327 | int c, cpu, nr_cpus; | 327 | int c, cpu, nr_cpus; |
328 | const struct cpu_map *cpu_map = NULL; | 328 | const struct perf_cpu_map *cpu_map = NULL; |
329 | 329 | ||
330 | cpu_map = cpu_map__online(); | 330 | cpu_map = cpu_map__online(); |
331 | if (!cpu_map) | 331 | if (!cpu_map) |
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 0540303e5e97..077509609d03 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -322,7 +322,7 @@ __add_event(struct list_head *list, int *idx, | |||
322 | const char *cpu_list) | 322 | const char *cpu_list) |
323 | { | 323 | { |
324 | struct perf_evsel *evsel; | 324 | struct perf_evsel *evsel; |
325 | struct cpu_map *cpus = pmu ? pmu->cpus : | 325 | struct perf_cpu_map *cpus = pmu ? pmu->cpus : |
326 | cpu_list ? cpu_map__new(cpu_list) : NULL; | 326 | cpu_list ? cpu_map__new(cpu_list) : NULL; |
327 | 327 | ||
328 | event_attr_init(attr); | 328 | event_attr_init(attr); |
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index f32b710347db..4929a50c0973 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c | |||
@@ -572,10 +572,10 @@ static void pmu_read_sysfs(void) | |||
572 | closedir(dir); | 572 | closedir(dir); |
573 | } | 573 | } |
574 | 574 | ||
575 | static struct cpu_map *__pmu_cpumask(const char *path) | 575 | static struct perf_cpu_map *__pmu_cpumask(const char *path) |
576 | { | 576 | { |
577 | FILE *file; | 577 | FILE *file; |
578 | struct cpu_map *cpus; | 578 | struct perf_cpu_map *cpus; |
579 | 579 | ||
580 | file = fopen(path, "r"); | 580 | file = fopen(path, "r"); |
581 | if (!file) | 581 | if (!file) |
@@ -593,10 +593,10 @@ static struct cpu_map *__pmu_cpumask(const char *path) | |||
593 | #define CPUS_TEMPLATE_UNCORE "%s/bus/event_source/devices/%s/cpumask" | 593 | #define CPUS_TEMPLATE_UNCORE "%s/bus/event_source/devices/%s/cpumask" |
594 | #define CPUS_TEMPLATE_CPU "%s/bus/event_source/devices/%s/cpus" | 594 | #define CPUS_TEMPLATE_CPU "%s/bus/event_source/devices/%s/cpus" |
595 | 595 | ||
596 | static struct cpu_map *pmu_cpumask(const char *name) | 596 | static struct perf_cpu_map *pmu_cpumask(const char *name) |
597 | { | 597 | { |
598 | char path[PATH_MAX]; | 598 | char path[PATH_MAX]; |
599 | struct cpu_map *cpus; | 599 | struct perf_cpu_map *cpus; |
600 | const char *sysfs = sysfs__mountpoint(); | 600 | const char *sysfs = sysfs__mountpoint(); |
601 | const char *templates[] = { | 601 | const char *templates[] = { |
602 | CPUS_TEMPLATE_UNCORE, | 602 | CPUS_TEMPLATE_UNCORE, |
@@ -621,7 +621,7 @@ static struct cpu_map *pmu_cpumask(const char *name) | |||
621 | static bool pmu_is_uncore(const char *name) | 621 | static bool pmu_is_uncore(const char *name) |
622 | { | 622 | { |
623 | char path[PATH_MAX]; | 623 | char path[PATH_MAX]; |
624 | struct cpu_map *cpus; | 624 | struct perf_cpu_map *cpus; |
625 | const char *sysfs = sysfs__mountpoint(); | 625 | const char *sysfs = sysfs__mountpoint(); |
626 | 626 | ||
627 | snprintf(path, PATH_MAX, CPUS_TEMPLATE_UNCORE, sysfs, name); | 627 | snprintf(path, PATH_MAX, CPUS_TEMPLATE_UNCORE, sysfs, name); |
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h index bd9ec2704a57..3f8b79b1dd85 100644 --- a/tools/perf/util/pmu.h +++ b/tools/perf/util/pmu.h | |||
@@ -28,7 +28,7 @@ struct perf_pmu { | |||
28 | bool is_uncore; | 28 | bool is_uncore; |
29 | int max_precise; | 29 | int max_precise; |
30 | struct perf_event_attr *default_config; | 30 | struct perf_event_attr *default_config; |
31 | struct cpu_map *cpus; | 31 | struct perf_cpu_map *cpus; |
32 | struct list_head format; /* HEAD struct perf_pmu_format -> list */ | 32 | struct list_head format; /* HEAD struct perf_pmu_format -> list */ |
33 | struct list_head aliases; /* HEAD struct perf_pmu_alias -> list */ | 33 | struct list_head aliases; /* HEAD struct perf_pmu_alias -> list */ |
34 | struct list_head list; /* ELEM */ | 34 | struct list_head list; /* ELEM */ |
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index 1e5b6718dcea..be27956ae080 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c | |||
@@ -536,7 +536,7 @@ static PyObject *pyrf_event__new(union perf_event *event) | |||
536 | struct pyrf_cpu_map { | 536 | struct pyrf_cpu_map { |
537 | PyObject_HEAD | 537 | PyObject_HEAD |
538 | 538 | ||
539 | struct cpu_map *cpus; | 539 | struct perf_cpu_map *cpus; |
540 | }; | 540 | }; |
541 | 541 | ||
542 | static int pyrf_cpu_map__init(struct pyrf_cpu_map *pcpus, | 542 | static int pyrf_cpu_map__init(struct pyrf_cpu_map *pcpus, |
@@ -796,7 +796,7 @@ static PyObject *pyrf_evsel__open(struct pyrf_evsel *pevsel, | |||
796 | PyObject *args, PyObject *kwargs) | 796 | PyObject *args, PyObject *kwargs) |
797 | { | 797 | { |
798 | struct perf_evsel *evsel = &pevsel->evsel; | 798 | struct perf_evsel *evsel = &pevsel->evsel; |
799 | struct cpu_map *cpus = NULL; | 799 | struct perf_cpu_map *cpus = NULL; |
800 | struct thread_map *threads = NULL; | 800 | struct thread_map *threads = NULL; |
801 | PyObject *pcpus = NULL, *pthreads = NULL; | 801 | PyObject *pcpus = NULL, *pthreads = NULL; |
802 | int group = 0, inherit = 0; | 802 | int group = 0, inherit = 0; |
@@ -865,7 +865,7 @@ static int pyrf_evlist__init(struct pyrf_evlist *pevlist, | |||
865 | PyObject *args, PyObject *kwargs __maybe_unused) | 865 | PyObject *args, PyObject *kwargs __maybe_unused) |
866 | { | 866 | { |
867 | PyObject *pcpus = NULL, *pthreads = NULL; | 867 | PyObject *pcpus = NULL, *pthreads = NULL; |
868 | struct cpu_map *cpus; | 868 | struct perf_cpu_map *cpus; |
869 | struct thread_map *threads; | 869 | struct thread_map *threads; |
870 | 870 | ||
871 | if (!PyArg_ParseTuple(args, "OO", &pcpus, &pthreads)) | 871 | if (!PyArg_ParseTuple(args, "OO", &pcpus, &pthreads)) |
diff --git a/tools/perf/util/record.c b/tools/perf/util/record.c index 9cfc7bf16531..051c67f82548 100644 --- a/tools/perf/util/record.c +++ b/tools/perf/util/record.c | |||
@@ -60,7 +60,7 @@ out_delete: | |||
60 | static bool perf_probe_api(setup_probe_fn_t fn) | 60 | static bool perf_probe_api(setup_probe_fn_t fn) |
61 | { | 61 | { |
62 | const char *try[] = {"cycles:u", "instructions:u", "cpu-clock:u", NULL}; | 62 | const char *try[] = {"cycles:u", "instructions:u", "cpu-clock:u", NULL}; |
63 | struct cpu_map *cpus; | 63 | struct perf_cpu_map *cpus; |
64 | int cpu, ret, i = 0; | 64 | int cpu, ret, i = 0; |
65 | 65 | ||
66 | cpus = cpu_map__new(NULL); | 66 | cpus = cpu_map__new(NULL); |
@@ -115,7 +115,7 @@ bool perf_can_record_cpu_wide(void) | |||
115 | .config = PERF_COUNT_SW_CPU_CLOCK, | 115 | .config = PERF_COUNT_SW_CPU_CLOCK, |
116 | .exclude_kernel = 1, | 116 | .exclude_kernel = 1, |
117 | }; | 117 | }; |
118 | struct cpu_map *cpus; | 118 | struct perf_cpu_map *cpus; |
119 | int cpu, fd; | 119 | int cpu, fd; |
120 | 120 | ||
121 | cpus = cpu_map__new(NULL); | 121 | cpus = cpu_map__new(NULL); |
@@ -275,7 +275,7 @@ bool perf_evlist__can_select_event(struct perf_evlist *evlist, const char *str) | |||
275 | evsel = perf_evlist__last(temp_evlist); | 275 | evsel = perf_evlist__last(temp_evlist); |
276 | 276 | ||
277 | if (!evlist || cpu_map__empty(evlist->cpus)) { | 277 | if (!evlist || cpu_map__empty(evlist->cpus)) { |
278 | struct cpu_map *cpus = cpu_map__new(NULL); | 278 | struct perf_cpu_map *cpus = cpu_map__new(NULL); |
279 | 279 | ||
280 | cpu = cpus ? cpus->map[0] : 0; | 280 | cpu = cpus ? cpus->map[0] : 0; |
281 | cpu_map__put(cpus); | 281 | cpu_map__put(cpus); |
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index 25dc1d765553..a53b30b8819b 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c | |||
@@ -1393,7 +1393,7 @@ static void python_process_stat(struct perf_stat_config *config, | |||
1393 | struct perf_evsel *counter, u64 tstamp) | 1393 | struct perf_evsel *counter, u64 tstamp) |
1394 | { | 1394 | { |
1395 | struct thread_map *threads = counter->threads; | 1395 | struct thread_map *threads = counter->threads; |
1396 | struct cpu_map *cpus = counter->cpus; | 1396 | struct perf_cpu_map *cpus = counter->cpus; |
1397 | int cpu, thread; | 1397 | int cpu, thread; |
1398 | 1398 | ||
1399 | if (config->aggr_mode == AGGR_GLOBAL) { | 1399 | if (config->aggr_mode == AGGR_GLOBAL) { |
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 37efa1f43d8b..69d1d158a610 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -2273,7 +2273,7 @@ int perf_session__cpu_bitmap(struct perf_session *session, | |||
2273 | const char *cpu_list, unsigned long *cpu_bitmap) | 2273 | const char *cpu_list, unsigned long *cpu_bitmap) |
2274 | { | 2274 | { |
2275 | int i, err = -1; | 2275 | int i, err = -1; |
2276 | struct cpu_map *map; | 2276 | struct perf_cpu_map *map; |
2277 | 2277 | ||
2278 | for (i = 0; i < PERF_TYPE_MAX; ++i) { | 2278 | for (i = 0; i < PERF_TYPE_MAX; ++i) { |
2279 | struct perf_evsel *evsel; | 2279 | struct perf_evsel *evsel; |
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c index db8a6cf336be..62791c063f7a 100644 --- a/tools/perf/util/stat.c +++ b/tools/perf/util/stat.c | |||
@@ -215,7 +215,7 @@ static int check_per_pkg(struct perf_evsel *counter, | |||
215 | struct perf_counts_values *vals, int cpu, bool *skip) | 215 | struct perf_counts_values *vals, int cpu, bool *skip) |
216 | { | 216 | { |
217 | unsigned long *mask = counter->per_pkg_mask; | 217 | unsigned long *mask = counter->per_pkg_mask; |
218 | struct cpu_map *cpus = perf_evsel__cpus(counter); | 218 | struct perf_cpu_map *cpus = perf_evsel__cpus(counter); |
219 | int s; | 219 | int s; |
220 | 220 | ||
221 | *skip = false; | 221 | *skip = false; |
diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h index 7032dd1eeac2..fa675d09febd 100644 --- a/tools/perf/util/stat.h +++ b/tools/perf/util/stat.h | |||
@@ -92,7 +92,7 @@ struct runtime_stat { | |||
92 | }; | 92 | }; |
93 | 93 | ||
94 | typedef int (*aggr_get_id_t)(struct perf_stat_config *config, | 94 | typedef int (*aggr_get_id_t)(struct perf_stat_config *config, |
95 | struct cpu_map *m, int cpu); | 95 | struct perf_cpu_map *m, int cpu); |
96 | 96 | ||
97 | struct perf_stat_config { | 97 | struct perf_stat_config { |
98 | enum aggr_mode aggr_mode; | 98 | enum aggr_mode aggr_mode; |
@@ -122,9 +122,9 @@ struct perf_stat_config { | |||
122 | const char *csv_sep; | 122 | const char *csv_sep; |
123 | struct stats *walltime_nsecs_stats; | 123 | struct stats *walltime_nsecs_stats; |
124 | struct rusage ru_data; | 124 | struct rusage ru_data; |
125 | struct cpu_map *aggr_map; | 125 | struct perf_cpu_map *aggr_map; |
126 | aggr_get_id_t aggr_get_id; | 126 | aggr_get_id_t aggr_get_id; |
127 | struct cpu_map *cpus_aggr_map; | 127 | struct perf_cpu_map *cpus_aggr_map; |
128 | u64 *walltime_run; | 128 | u64 *walltime_run; |
129 | struct rblist metric_events; | 129 | struct rblist metric_events; |
130 | }; | 130 | }; |
diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c index 76cc54000483..99132c6a30a6 100644 --- a/tools/perf/util/svghelper.c +++ b/tools/perf/util/svghelper.c | |||
@@ -728,7 +728,7 @@ static int str_to_bitmap(char *s, cpumask_t *b) | |||
728 | { | 728 | { |
729 | int i; | 729 | int i; |
730 | int ret = 0; | 730 | int ret = 0; |
731 | struct cpu_map *m; | 731 | struct perf_cpu_map *m; |
732 | int c; | 732 | int c; |
733 | 733 | ||
734 | m = cpu_map__new(s); | 734 | m = cpu_map__new(s); |