mirror of
https://github.com/anrieff/libcpuid
synced 2024-11-20 23:01:51 +00:00
Improve cpuid_tool behavior when cpu_types array is empty
It happens when cpuid_get_all_raw_data() cannot use set_cpu_affinity()
This commit is contained in:
parent
2133c22052
commit
c6723aa914
1 changed files with 64 additions and 61 deletions
|
@ -758,15 +758,17 @@ int main(int argc, char** argv)
|
||||||
if (verbose_level >= 1) {
|
if (verbose_level >= 1) {
|
||||||
printf("Writing decoded CPU report to `%s'\n", out_file);
|
printf("Writing decoded CPU report to `%s'\n", out_file);
|
||||||
}
|
}
|
||||||
/* Write a thorough report of cpu_id_t structure to output (usually stdout) */
|
|
||||||
fprintf(fout, "CPUID is present\n");
|
|
||||||
/*
|
/*
|
||||||
* Try CPU identification
|
* Try CPU identification
|
||||||
* (this fill the `data' structure with decoded CPU features)
|
* (this fill the `data' structure with decoded CPU features)
|
||||||
*/
|
*/
|
||||||
if (cpu_identify_all(&raw_array, &data) < 0)
|
if (cpu_identify_all(&raw_array, &data) < 0)
|
||||||
fprintf(fout, "Error identifying the CPU: %s\n", cpuid_error());
|
fprintf(fout, "Error identifying the CPU: %s\n", cpuid_error());
|
||||||
|
else if (data.num_cpu_types == 0)
|
||||||
|
fprintf(fout, "The cpu_types array is empty: there is nothing to report\n");
|
||||||
|
else {
|
||||||
|
/* Write a thorough report of cpu_id_t structure to output (usually stdout) */
|
||||||
|
fprintf(fout, "CPUID is present\n");
|
||||||
/* OK, now write what we have in `data'...: */
|
/* OK, now write what we have in `data'...: */
|
||||||
for (cpu_type_index = 0; cpu_type_index < data.num_cpu_types; cpu_type_index++) {
|
for (cpu_type_index = 0; cpu_type_index < data.num_cpu_types; cpu_type_index++) {
|
||||||
fprintf(fout, "CPU Info for type #%d:\n------------------\n", cpu_type_index);
|
fprintf(fout, "CPU Info for type #%d:\n------------------\n", cpu_type_index);
|
||||||
|
@ -827,6 +829,7 @@ int main(int argc, char** argv)
|
||||||
fprintf(fout, " %s", cpu_feature_str(i));
|
fprintf(fout, " %s", cpu_feature_str(i));
|
||||||
fprintf(fout, "\n");
|
fprintf(fout, "\n");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Is CPU clock info requested? */
|
/* Is CPU clock info requested? */
|
||||||
if (need_clockreport) {
|
if (need_clockreport) {
|
||||||
|
|
Loading…
Reference in a new issue