Lines Matching full:cpus
21 RC_STRUCT(perf_cpu_map) *cpus;
27 cpus = malloc(sizeof(*cpus) + sizeof(struct perf_cpu) * nr_cpus);
28 if (ADD_RC_CHK(result, cpus)) {
29 cpus->nr = nr_cpus;
30 refcount_set(&cpus->refcnt, 1);
37 struct perf_cpu_map *cpus = perf_cpu_map__alloc(1);
39 if (cpus)
40 RC_CHK_ACCESS(cpus)->map[0].cpu = -1;
42 return cpus;
76 struct perf_cpu_map *cpus;
85 pr_warning("Number of online CPUs (%d) differs from the number configured (%d) the CPU map will only cover the first %d CPUs.",
89 cpus = perf_cpu_map__alloc(nr_cpus);
90 if (cpus != NULL) {
94 RC_CHK_ACCESS(cpus)->map[i].cpu = i;
97 return cpus;
102 struct perf_cpu_map *cpus = NULL;
107 cpus = perf_cpu_map__read(onlnf);
110 return cpus;
115 struct perf_cpu_map *cpus = cpu_map__new_sysfs_online();
117 if (cpus)
118 return cpus;
131 static struct perf_cpu __perf_cpu_map__cpu(const struct perf_cpu_map *cpus, int idx)
133 return RC_CHK_ACCESS(cpus)->map[idx];
139 struct perf_cpu_map *cpus = perf_cpu_map__alloc(nr_cpus);
142 if (cpus != NULL) {
143 memcpy(RC_CHK_ACCESS(cpus)->map, tmp_cpus, payload_size);
144 qsort(RC_CHK_ACCESS(cpus)->map, nr_cpus, sizeof(struct perf_cpu), cmp_cpu);
149 __perf_cpu_map__cpu(cpus, i).cpu !=
150 __perf_cpu_map__cpu(cpus, i - 1).cpu) {
151 RC_CHK_ACCESS(cpus)->map[j++].cpu =
152 __perf_cpu_map__cpu(cpus, i).cpu;
155 perf_cpu_map__set_nr(cpus, j);
158 return cpus;
163 struct perf_cpu_map *cpus = NULL;
179 WARN_ONCE(new_max >= MAX_NR_CPUS, "Perf can support %d CPUs. "
211 cpus = cpu_map__trim_new(nr_cpus, tmp_cpus);
214 return cpus;
219 struct perf_cpu_map *cpus = NULL;
258 WARN_ONCE(end_cpu >= MAX_NR_CPUS, "Perf can support %d CPUs. "
283 cpus = cpu_map__trim_new(nr_cpus, tmp_cpus);
285 pr_warning("Unexpected characters at end of cpu list ('%s'), using online CPUs.",
287 cpus = perf_cpu_map__new_online_cpus();
289 cpus = perf_cpu_map__new_any_cpu();
293 return cpus;
296 static int __perf_cpu_map__nr(const struct perf_cpu_map *cpus)
298 return RC_CHK_ACCESS(cpus)->nr;
301 struct perf_cpu perf_cpu_map__cpu(const struct perf_cpu_map *cpus, int idx)
307 if (cpus && idx < __perf_cpu_map__nr(cpus))
308 return __perf_cpu_map__cpu(cpus, idx);
313 int perf_cpu_map__nr(const struct perf_cpu_map *cpus)
315 return cpus ? __perf_cpu_map__nr(cpus) : 1;
336 int perf_cpu_map__idx(const struct perf_cpu_map *cpus, struct perf_cpu cpu)
340 if (!cpus)
344 high = __perf_cpu_map__nr(cpus);
347 struct perf_cpu cpu_at_idx = __perf_cpu_map__cpu(cpus, idx);
361 bool perf_cpu_map__has(const struct perf_cpu_map *cpus, struct perf_cpu cpu)
363 return perf_cpu_map__idx(cpus, cpu) != -1;