Lines Matching +full:on +full:- +full:die

1 // SPDX-License-Identifier: GPL-2.0
25 map = perf_cpu_map__empty_new(cpus->nr); in cpu_map__from_entries()
29 for (i = 0; i < cpus->nr; i++) { in cpu_map__from_entries()
31 * Special treatment for -1, which is not real cpu number, in cpu_map__from_entries()
32 * and we need to use (int) -1 to initialize map[i], in cpu_map__from_entries()
35 if (cpus->cpu[i] == (u16) -1) in cpu_map__from_entries()
36 map->map[i] = -1; in cpu_map__from_entries()
38 map->map[i] = (int) cpus->cpu[i]; in cpu_map__from_entries()
48 int nr, nbits = mask->nr * mask->long_size * BITS_PER_BYTE; in cpu_map__from_mask()
50 nr = bitmap_weight(mask->mask, nbits); in cpu_map__from_mask()
56 for_each_set_bit(cpu, mask->mask, nbits) in cpu_map__from_mask()
57 map->map[i++] = cpu; in cpu_map__from_mask()
65 if (data->type == PERF_CPU_MAP__CPUS) in cpu_map__new_data()
66 return cpu_map__from_entries((struct cpu_map_entries *)data->data); in cpu_map__new_data()
68 return cpu_map__from_mask((struct perf_record_record_cpu_map *)data->data); in cpu_map__new_data()
88 cpus->nr = nr; in perf_cpu_map__empty_new()
90 cpus->map[i] = -1; in perf_cpu_map__empty_new()
92 refcount_set(&cpus->refcnt, 1); in perf_cpu_map__empty_new()
105 cpus->nr = nr; in cpu_aggr_map__empty_new()
107 cpus->map[i] = cpu_map__empty_aggr_cpu_id(); in cpu_aggr_map__empty_new()
109 refcount_set(&cpus->refcnt, 1); in cpu_aggr_map__empty_new()
137 if (idx > map->nr) in cpu_map__get_socket()
140 cpu = map->map[idx]; in cpu_map__get_socket()
151 if (a->node != b->node) in cmp_aggr_cpu_id()
152 return a->node - b->node; in cmp_aggr_cpu_id()
153 else if (a->socket != b->socket) in cmp_aggr_cpu_id()
154 return a->socket - b->socket; in cmp_aggr_cpu_id()
155 else if (a->die != b->die) in cmp_aggr_cpu_id()
156 return a->die - b->die; in cmp_aggr_cpu_id()
157 else if (a->core != b->core) in cmp_aggr_cpu_id()
158 return a->core - b->core; in cmp_aggr_cpu_id()
160 return a->thread - b->thread; in cmp_aggr_cpu_id()
167 int nr = cpus->nr; in cpu_map__build_map()
173 return -1; in cpu_map__build_map()
176 c->nr = 0; in cpu_map__build_map()
180 for (s2 = 0; s2 < c->nr; s2++) { in cpu_map__build_map()
181 if (cpu_map__compare_aggr_cpu_id(s1, c->map[s2])) in cpu_map__build_map()
184 if (s2 == c->nr) { in cpu_map__build_map()
185 c->map[c->nr] = s1; in cpu_map__build_map()
186 c->nr++; in cpu_map__build_map()
190 qsort(c->map, c->nr, sizeof(struct aggr_cpu_id), cmp_aggr_cpu_id); in cpu_map__build_map()
205 int cpu, die; in cpu_map__get_die() local
208 if (idx > map->nr) in cpu_map__get_die()
211 cpu = map->map[idx]; in cpu_map__get_die()
213 die = cpu_map__get_die_id(cpu); in cpu_map__get_die()
214 /* There is no die_id on legacy system. */ in cpu_map__get_die()
215 if (die == -1) in cpu_map__get_die()
216 die = 0; in cpu_map__get_die()
220 * with the socket ID and then add die to in cpu_map__get_die()
227 id.die = die; in cpu_map__get_die()
247 if (idx > map->nr) in cpu_map__get_core()
250 cpu = map->map[idx]; in cpu_map__get_core()
254 /* cpu_map__get_die returns a struct with socket and die set*/ in cpu_map__get_core()
260 * core_id is relative to socket and die, we need a global id. in cpu_map__get_core()
271 if (idx < 0 || idx >= map->nr) in cpu_map__get_node()
274 id.node = cpu_map__get_node_id(map->map[idx]); in cpu_map__get_node()
306 return -1; in get_max_num()
310 /* start on the right, to find highest node num */ in get_max_num()
311 while (--num) { in get_max_num()
312 if ((buf[num] == ',') || (buf[num] == '-')) { in get_max_num()
318 err = -1; in get_max_num()
322 /* convert from 0-based to 1-based */ in get_max_num()
335 int ret = -1; in set_max_cpu_num()
375 int ret = -1; in set_max_node_num()
427 return -1; in cpu__get_node()
443 return -1; in init_cpunode_map()
447 cpunode_map[i] = -1; in init_cpunode_map()
464 return -1; in cpu__setup_cpunode_map()
473 return -1; in cpu__setup_cpunode_map()
482 if (dent1->d_type != DT_DIR || sscanf(dent1->d_name, "node%u", &mem) < 1) in cpu__setup_cpunode_map()
485 n = snprintf(buf, PATH_MAX, "%s/%s", path, dent1->d_name); in cpu__setup_cpunode_map()
495 if (dent2->d_type != DT_LNK || sscanf(dent2->d_name, "cpu%u", &cpu) < 1) in cpu__setup_cpunode_map()
507 return perf_cpu_map__idx(cpus, cpu) != -1; in cpu_map__has()
512 return cpus->map[idx]; in cpu_map__cpu()
517 int i, cpu, start = -1; in cpu_map__snprint()
523 for (i = 0; i < map->nr + 1; i++) { in cpu_map__snprint()
524 bool last = i == map->nr; in cpu_map__snprint()
526 cpu = last ? INT_MAX : map->map[i]; in cpu_map__snprint()
528 if (start == -1) { in cpu_map__snprint()
531 ret += snprintf(buf + ret, size - ret, in cpu_map__snprint()
533 map->map[i]); in cpu_map__snprint()
535 } else if (((i - start) != (cpu - map->map[start])) || last) { in cpu_map__snprint()
536 int end = i - 1; in cpu_map__snprint()
539 ret += snprintf(buf + ret, size - ret, in cpu_map__snprint()
541 map->map[start]); in cpu_map__snprint()
543 ret += snprintf(buf + ret, size - ret, in cpu_map__snprint()
544 "%s%d-%d", COMMA, in cpu_map__snprint()
545 map->map[start], map->map[end]); in cpu_map__snprint()
563 return val - 10 + 'a'; in hex_char()
572 int last_cpu = cpu_map__cpu(map, map->nr - 1); in cpu_map__snprint_mask()
583 for (i = 0; i < map->nr; i++) { in cpu_map__snprint_mask()
588 for (cpu = last_cpu / 4 * 4; cpu >= 0; cpu -= 4) { in cpu_map__snprint_mask()
603 buf[size - 1] = '\0'; in cpu_map__snprint_mask()
604 return ptr - buf; in cpu_map__snprint_mask()
622 a.die == b.die && in cpu_map__compare_aggr_cpu_id()
628 return a.thread == -1 && in cpu_map__aggr_cpu_id_is_empty()
629 a.node == -1 && in cpu_map__aggr_cpu_id_is_empty()
630 a.socket == -1 && in cpu_map__aggr_cpu_id_is_empty()
631 a.die == -1 && in cpu_map__aggr_cpu_id_is_empty()
632 a.core == -1; in cpu_map__aggr_cpu_id_is_empty()
638 .thread = -1, in cpu_map__empty_aggr_cpu_id()
639 .node = -1, in cpu_map__empty_aggr_cpu_id()
640 .socket = -1, in cpu_map__empty_aggr_cpu_id()
641 .die = -1, in cpu_map__empty_aggr_cpu_id()
642 .core = -1 in cpu_map__empty_aggr_cpu_id()