Lines Matching full:cpus

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