for (i = 0; i < tp->package_cpus_lists; i++) { if (!strcmp(buf, tp->package_cpus_list[i])) break;
} if (i == tp->package_cpus_lists) {
tp->package_cpus_list[i] = buf;
tp->package_cpus_lists++;
buf = NULL;
len = 0;
}
ret = 0;
try_dies: if (!tp->die_cpus_list) goto try_threads;
for (i = 0; i < tp->die_cpus_lists; i++) { if (!strcmp(buf, tp->die_cpus_list[i])) break;
} if (i == tp->die_cpus_lists) {
tp->die_cpus_list[i] = buf;
tp->die_cpus_lists++;
buf = NULL;
len = 0;
}
ret = 0;
for (i = 0; i < tp->core_cpus_lists; i++) { if (!strcmp(buf, tp->core_cpus_list[i])) break;
} if (i == tp->core_cpus_lists) {
tp->core_cpus_list[i] = buf;
tp->core_cpus_lists++;
buf = NULL;
}
ret = 0;
done: if (fp)
fclose(fp);
free(buf); return ret;
}
for (i = 0 ; i < tp->package_cpus_lists; i++)
zfree(&tp->package_cpus_list[i]);
for (i = 0 ; i < tp->die_cpus_lists; i++)
zfree(&tp->die_cpus_list[i]);
for (i = 0 ; i < tp->core_cpus_lists; i++)
zfree(&tp->core_cpus_list[i]);
free(tp);
}
bool cpu_topology__smt_on(conststruct cpu_topology *topology)
{ for (u32 i = 0; i < topology->core_cpus_lists; i++) { constchar *cpu_list = topology->core_cpus_list[i];
/* * If there is a need to separate siblings in a core then SMT is * enabled.
*/ if (strchr(cpu_list, ',') || strchr(cpu_list, '-')) returntrue;
} returnfalse;
}
/* * If user_requested_cpu_list is empty then all CPUs are recorded and so * core_wide is true.
*/ if (!user_requested_cpu_list) returntrue;
user_requested_cpus = perf_cpu_map__new(user_requested_cpu_list); /* Check that every user requested CPU is the complete set of SMT threads on a core. */ for (u32 i = 0; i < topology->core_cpus_lists; i++) { constchar *core_cpu_list = topology->core_cpus_list[i]; struct perf_cpu_map *core_cpus = perf_cpu_map__new(core_cpu_list); struct perf_cpu cpu; int idx; bool has_first, first = true;
perf_cpu_map__for_each_cpu(cpu, idx, core_cpus) { if (first) {
has_first = perf_cpu_map__has(user_requested_cpus, cpu);
first = false;
} else { /* * If the first core CPU is user requested then * all subsequent CPUs in the core must be user * requested too. If the first CPU isn't user * requested then none of the others must be * too.
*/ if (perf_cpu_map__has(user_requested_cpus, cpu) != has_first) {
perf_cpu_map__put(core_cpus);
perf_cpu_map__put(user_requested_cpus); returnfalse;
}
}
}
perf_cpu_map__put(core_cpus);
}
perf_cpu_map__put(user_requested_cpus); returntrue;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.