Lines Matching refs:cpus
15 struct perf_cpu_map *cpus = malloc(sizeof(*cpus) + sizeof(struct perf_cpu) * nr_cpus); in perf_cpu_map__alloc() local
17 if (cpus != NULL) { in perf_cpu_map__alloc()
18 cpus->nr = nr_cpus; in perf_cpu_map__alloc()
19 refcount_set(&cpus->refcnt, 1); in perf_cpu_map__alloc()
22 return cpus; in perf_cpu_map__alloc()
27 struct perf_cpu_map *cpus = perf_cpu_map__alloc(1); in perf_cpu_map__dummy_new() local
29 if (cpus) in perf_cpu_map__dummy_new()
30 cpus->map[0].cpu = -1; in perf_cpu_map__dummy_new()
32 return cpus; in perf_cpu_map__dummy_new()
59 struct perf_cpu_map *cpus; in cpu_map__default_new() local
66 cpus = perf_cpu_map__alloc(nr_cpus); in cpu_map__default_new()
67 if (cpus != NULL) { in cpu_map__default_new()
71 cpus->map[i].cpu = i; in cpu_map__default_new()
74 return cpus; in cpu_map__default_new()
93 struct perf_cpu_map *cpus = perf_cpu_map__alloc(nr_cpus); in cpu_map__trim_new() local
96 if (cpus != NULL) { in cpu_map__trim_new()
97 memcpy(cpus->map, tmp_cpus, payload_size); in cpu_map__trim_new()
98 qsort(cpus->map, nr_cpus, sizeof(struct perf_cpu), cmp_cpu); in cpu_map__trim_new()
102 if (i == 0 || cpus->map[i].cpu != cpus->map[i - 1].cpu) in cpu_map__trim_new()
103 cpus->map[j++].cpu = cpus->map[i].cpu; in cpu_map__trim_new()
105 cpus->nr = j; in cpu_map__trim_new()
108 return cpus; in cpu_map__trim_new()
113 struct perf_cpu_map *cpus = NULL; in perf_cpu_map__read() local
161 cpus = cpu_map__trim_new(nr_cpus, tmp_cpus); in perf_cpu_map__read()
163 cpus = cpu_map__default_new(); in perf_cpu_map__read()
166 return cpus; in perf_cpu_map__read()
171 struct perf_cpu_map *cpus = NULL; in cpu_map__read_all_cpu_map() local
178 cpus = perf_cpu_map__read(onlnf); in cpu_map__read_all_cpu_map()
180 return cpus; in cpu_map__read_all_cpu_map()
185 struct perf_cpu_map *cpus = NULL; in perf_cpu_map__new() local
249 cpus = cpu_map__trim_new(nr_cpus, tmp_cpus); in perf_cpu_map__new()
251 cpus = cpu_map__default_new(); in perf_cpu_map__new()
253 cpus = perf_cpu_map__dummy_new(); in perf_cpu_map__new()
257 return cpus; in perf_cpu_map__new()
260 struct perf_cpu perf_cpu_map__cpu(const struct perf_cpu_map *cpus, int idx) in perf_cpu_map__cpu() argument
266 if (cpus && idx < cpus->nr) in perf_cpu_map__cpu()
267 return cpus->map[idx]; in perf_cpu_map__cpu()
272 int perf_cpu_map__nr(const struct perf_cpu_map *cpus) in perf_cpu_map__nr() argument
274 return cpus ? cpus->nr : 1; in perf_cpu_map__nr()
282 int perf_cpu_map__idx(const struct perf_cpu_map *cpus, struct perf_cpu cpu) in perf_cpu_map__idx() argument
286 if (!cpus) in perf_cpu_map__idx()
290 high = cpus->nr; in perf_cpu_map__idx()
293 struct perf_cpu cpu_at_idx = cpus->map[idx]; in perf_cpu_map__idx()
307 bool perf_cpu_map__has(const struct perf_cpu_map *cpus, struct perf_cpu cpu) in perf_cpu_map__has() argument
309 return perf_cpu_map__idx(cpus, cpu) != -1; in perf_cpu_map__has()