• Home
  • Raw
  • Download

Lines Matching +full:cpu +full:- +full:nr

1 // SPDX-License-Identifier: GPL-2.0-only
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()
29 WARN_ONCE(refcount_read(&map->refcnt) != 0, in cpu_map__delete()
38 refcount_inc(&map->refcnt); in perf_cpu_map__get()
44 if (map && refcount_dec_and_test(&map->refcnt)) in perf_cpu_map__put()
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()
73 return *(const int *)a - *(const int*)b; in cmp_int()
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()
105 int n, cpu, prev; in perf_cpu_map__read() local
109 prev = -1; in perf_cpu_map__read()
111 n = fscanf(file, "%u%c", &cpu, &sep); in perf_cpu_map__read()
115 int new_max = nr_cpus + cpu - prev - 1; in perf_cpu_map__read()
128 while (++prev < cpu) in perf_cpu_map__read()
139 tmp_cpus[nr_cpus++] = cpu; in perf_cpu_map__read()
140 if (n == 2 && sep == '-') in perf_cpu_map__read()
141 prev = cpu; in perf_cpu_map__read()
143 prev = -1; in perf_cpu_map__read()
162 onlnf = fopen("/sys/devices/system/cpu/online", "r"); in cpu_map__read_all_cpu_map()
185 * TOPOLOGY header for NUMA nodes with no CPU in perf_cpu_map__new()
186 * ( e.g., because of CPU hotplug) in perf_cpu_map__new()
195 || (*p != '\0' && *p != ',' && *p != '-')) in perf_cpu_map__new()
198 if (*p == '-') { in perf_cpu_map__new()
250 if (cpus && idx < cpus->nr) in perf_cpu_map__cpu()
251 return cpus->map[idx]; in perf_cpu_map__cpu()
253 return -1; in perf_cpu_map__cpu()
258 return cpus ? cpus->nr : 1; in perf_cpu_map__nr()
263 return map ? map->map[0] == -1 : true; in perf_cpu_map__empty()
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()
275 return -1; in perf_cpu_map__idx()
280 int i, max = -1; in perf_cpu_map__max()
282 for (i = 0; i < map->nr; i++) { in perf_cpu_map__max()
283 if (map->map[i] > max) in perf_cpu_map__max()
284 max = map->map[i]; in perf_cpu_map__max()
314 if (orig->nr == other->nr && in perf_cpu_map__merge()
315 !memcmp(orig->map, other->map, orig->nr * sizeof(int))) in perf_cpu_map__merge()
318 tmp_len = orig->nr + other->nr; in perf_cpu_map__merge()
325 while (i < orig->nr && j < other->nr) { in perf_cpu_map__merge()
326 if (orig->map[i] <= other->map[j]) { in perf_cpu_map__merge()
327 if (orig->map[i] == other->map[j]) in perf_cpu_map__merge()
329 tmp_cpus[k++] = orig->map[i++]; in perf_cpu_map__merge()
331 tmp_cpus[k++] = other->map[j++]; in perf_cpu_map__merge()
334 while (i < orig->nr) in perf_cpu_map__merge()
335 tmp_cpus[k++] = orig->map[i++]; in perf_cpu_map__merge()
337 while (j < other->nr) in perf_cpu_map__merge()
338 tmp_cpus[k++] = other->map[j++]; in perf_cpu_map__merge()