Lines Matching full:cpus
15 struct perf_cpu_map *cpus = malloc(sizeof(*cpus) + sizeof(int)); in perf_cpu_map__dummy_new() local
17 if (cpus != NULL) { in perf_cpu_map__dummy_new()
18 cpus->nr = 1; in perf_cpu_map__dummy_new()
19 cpus->map[0] = -1; in perf_cpu_map__dummy_new()
20 refcount_set(&cpus->refcnt, 1); in perf_cpu_map__dummy_new()
23 return cpus; in perf_cpu_map__dummy_new()
50 struct perf_cpu_map *cpus; in cpu_map__default_new() local
57 cpus = malloc(sizeof(*cpus) + nr_cpus * sizeof(int)); in cpu_map__default_new()
58 if (cpus != NULL) { in cpu_map__default_new()
62 cpus->map[i] = i; in cpu_map__default_new()
64 cpus->nr = nr_cpus; in cpu_map__default_new()
65 refcount_set(&cpus->refcnt, 1); in cpu_map__default_new()
68 return cpus; in cpu_map__default_new()
79 struct perf_cpu_map *cpus = malloc(sizeof(*cpus) + payload_size); in cpu_map__trim_new() local
82 if (cpus != NULL) { in cpu_map__trim_new()
83 memcpy(cpus->map, tmp_cpus, payload_size); in cpu_map__trim_new()
84 qsort(cpus->map, nr_cpus, sizeof(int), cmp_int); in cpu_map__trim_new()
88 if (i == 0 || cpus->map[i] != cpus->map[i - 1]) in cpu_map__trim_new()
89 cpus->map[j++] = cpus->map[i]; in cpu_map__trim_new()
91 cpus->nr = j; in cpu_map__trim_new()
93 refcount_set(&cpus->refcnt, 1); in cpu_map__trim_new()
96 return cpus; in cpu_map__trim_new()
101 struct perf_cpu_map *cpus = NULL; in perf_cpu_map__read() local
117 WARN_ONCE(new_max >= MAX_NR_CPUS, "Perf can support %d CPUs. " in perf_cpu_map__read()
149 cpus = cpu_map__trim_new(nr_cpus, tmp_cpus); in perf_cpu_map__read()
151 cpus = cpu_map__default_new(); in perf_cpu_map__read()
154 return cpus; in perf_cpu_map__read()
159 struct perf_cpu_map *cpus = NULL; in cpu_map__read_all_cpu_map() local
166 cpus = perf_cpu_map__read(onlnf); in cpu_map__read_all_cpu_map()
168 return cpus; in cpu_map__read_all_cpu_map()
173 struct perf_cpu_map *cpus = NULL; in perf_cpu_map__new() local
212 WARN_ONCE(end_cpu >= MAX_NR_CPUS, "Perf can support %d CPUs. " in perf_cpu_map__new()
237 cpus = cpu_map__trim_new(nr_cpus, tmp_cpus); in perf_cpu_map__new()
239 cpus = cpu_map__default_new(); in perf_cpu_map__new()
241 cpus = perf_cpu_map__dummy_new(); in perf_cpu_map__new()
245 return cpus; in perf_cpu_map__new()
248 int perf_cpu_map__cpu(const struct perf_cpu_map *cpus, int idx) in perf_cpu_map__cpu() argument
250 if (cpus && idx < cpus->nr) in perf_cpu_map__cpu()
251 return cpus->map[idx]; in perf_cpu_map__cpu()
256 int perf_cpu_map__nr(const struct perf_cpu_map *cpus) in perf_cpu_map__nr() argument
258 return cpus ? cpus->nr : 1; in perf_cpu_map__nr()
266 int perf_cpu_map__idx(struct perf_cpu_map *cpus, int cpu) in perf_cpu_map__idx() argument
270 for (i = 0; i < cpus->nr; ++i) { in perf_cpu_map__idx()
271 if (cpus->map[i] == cpu) in perf_cpu_map__idx()