Lines Matching full:cpus
25 RC_STRUCT(perf_cpu_map) *cpus;
31 cpus = malloc(sizeof(*cpus) + sizeof(struct perf_cpu) * nr_cpus);
32 if (ADD_RC_CHK(result, cpus)) {
33 cpus->nr = nr_cpus;
34 refcount_set(&cpus->refcnt, 1);
41 struct perf_cpu_map *cpus = perf_cpu_map__alloc(1);
43 if (cpus)
44 RC_CHK_ACCESS(cpus)->map[0].cpu = -1;
46 return cpus;
80 struct perf_cpu_map *cpus;
89 pr_warning("Number of online CPUs (%d) differs from the number configured (%d) the CPU map will only cover the first %d CPUs.",
93 cpus = perf_cpu_map__alloc(nr_cpus);
94 if (cpus != NULL) {
98 RC_CHK_ACCESS(cpus)->map[i].cpu = i;
101 return cpus;
106 struct perf_cpu_map *cpus = NULL;
111 cpus = perf_cpu_map__new(buf);
114 return cpus;
119 struct perf_cpu_map *cpus = cpu_map__new_sysfs_online();
121 if (cpus)
122 return cpus;
135 static struct perf_cpu __perf_cpu_map__cpu(const struct perf_cpu_map *cpus, int idx)
137 return RC_CHK_ACCESS(cpus)->map[idx];
143 struct perf_cpu_map *cpus = perf_cpu_map__alloc(nr_cpus);
146 if (cpus != NULL) {
147 memcpy(RC_CHK_ACCESS(cpus)->map, tmp_cpus, payload_size);
148 qsort(RC_CHK_ACCESS(cpus)->map, nr_cpus, sizeof(struct perf_cpu), cmp_cpu);
153 __perf_cpu_map__cpu(cpus, i).cpu !=
154 __perf_cpu_map__cpu(cpus, i - 1).cpu) {
155 RC_CHK_ACCESS(cpus)->map[j++].cpu =
156 __perf_cpu_map__cpu(cpus, i).cpu;
159 perf_cpu_map__set_nr(cpus, j);
162 return cpus;
167 struct perf_cpu_map *cpus = NULL;
206 WARN_ONCE(end_cpu >= MAX_NR_CPUS, "Perf can support %d CPUs. "
231 cpus = cpu_map__trim_new(nr_cpus, tmp_cpus);
233 pr_warning("Unexpected characters at end of cpu list ('%s'), using online CPUs.",
235 cpus = perf_cpu_map__new_online_cpus();
237 cpus = perf_cpu_map__new_any_cpu();
242 return cpus;
245 static int __perf_cpu_map__nr(const struct perf_cpu_map *cpus)
247 return RC_CHK_ACCESS(cpus)->nr;
250 struct perf_cpu perf_cpu_map__cpu(const struct perf_cpu_map *cpus, int idx)
256 if (cpus && idx < __perf_cpu_map__nr(cpus))
257 return __perf_cpu_map__cpu(cpus, idx);
262 int perf_cpu_map__nr(const struct perf_cpu_map *cpus)
264 return cpus ? __perf_cpu_map__nr(cpus) : 1;
285 int perf_cpu_map__idx(const struct perf_cpu_map *cpus, struct perf_cpu cpu)
289 if (!cpus)
293 high = __perf_cpu_map__nr(cpus);
296 struct perf_cpu cpu_at_idx = __perf_cpu_map__cpu(cpus, idx);
310 bool perf_cpu_map__has(const struct perf_cpu_map *cpus, struct perf_cpu cpu)
312 return perf_cpu_map__idx(cpus, cpu) != -1;