Lines Matching refs:cpus
20 RC_STRUCT(perf_cpu_map) *cpus = malloc(sizeof(*cpus) + sizeof(struct perf_cpu) * nr_cpus);
23 if (ADD_RC_CHK(result, cpus)) {
24 cpus->nr = nr_cpus;
25 refcount_set(&cpus->refcnt, 1);
32 struct perf_cpu_map *cpus = perf_cpu_map__alloc(1);
34 if (cpus)
35 RC_CHK_ACCESS(cpus)->map[0].cpu = -1;
37 return cpus;
71 struct perf_cpu_map *cpus;
78 cpus = perf_cpu_map__alloc(nr_cpus);
79 if (cpus != NULL) {
83 RC_CHK_ACCESS(cpus)->map[i].cpu = i;
86 return cpus;
102 static struct perf_cpu __perf_cpu_map__cpu(const struct perf_cpu_map *cpus, int idx)
104 return RC_CHK_ACCESS(cpus)->map[idx];
110 struct perf_cpu_map *cpus = perf_cpu_map__alloc(nr_cpus);
113 if (cpus != NULL) {
114 memcpy(RC_CHK_ACCESS(cpus)->map, tmp_cpus, payload_size);
115 qsort(RC_CHK_ACCESS(cpus)->map, nr_cpus, sizeof(struct perf_cpu), cmp_cpu);
120 __perf_cpu_map__cpu(cpus, i).cpu !=
121 __perf_cpu_map__cpu(cpus, i - 1).cpu) {
122 RC_CHK_ACCESS(cpus)->map[j++].cpu =
123 __perf_cpu_map__cpu(cpus, i).cpu;
126 perf_cpu_map__set_nr(cpus, j);
129 return cpus;
134 struct perf_cpu_map *cpus = NULL;
182 cpus = cpu_map__trim_new(nr_cpus, tmp_cpus);
184 cpus = cpu_map__default_new();
187 return cpus;
192 struct perf_cpu_map *cpus = NULL;
199 cpus = perf_cpu_map__read(onlnf);
201 return cpus;
206 struct perf_cpu_map *cpus = NULL;
270 cpus = cpu_map__trim_new(nr_cpus, tmp_cpus);
272 cpus = cpu_map__default_new();
274 cpus = perf_cpu_map__dummy_new();
278 return cpus;
281 static int __perf_cpu_map__nr(const struct perf_cpu_map *cpus)
283 return RC_CHK_ACCESS(cpus)->nr;
286 struct perf_cpu perf_cpu_map__cpu(const struct perf_cpu_map *cpus, int idx)
292 if (cpus && idx < __perf_cpu_map__nr(cpus))
293 return __perf_cpu_map__cpu(cpus, idx);
298 int perf_cpu_map__nr(const struct perf_cpu_map *cpus)
300 return cpus ? __perf_cpu_map__nr(cpus) : 1;
308 int perf_cpu_map__idx(const struct perf_cpu_map *cpus, struct perf_cpu cpu)
312 if (!cpus)
316 high = __perf_cpu_map__nr(cpus);
319 struct perf_cpu cpu_at_idx = __perf_cpu_map__cpu(cpus, idx);
333 bool perf_cpu_map__has(const struct perf_cpu_map *cpus, struct perf_cpu cpu)
335 return perf_cpu_map__idx(cpus, cpu) != -1;