2006-03-21 Gwenole Beauchesne <gbeauchesne@mandriva.com> * Intel/info.c (display_Intel_info): Add multicore characterisation and fix logical processors detection. --- x86info-1.17/Intel/info.c.intel-multicore-htt 2005-11-05 01:05:52.000000000 +0100 +++ x86info-1.17/Intel/info.c 2006-03-21 23:43:42.000000000 +0100 @@ -20,6 +20,7 @@ void display_Intel_info (struct cpudata *cpu) { + int nr_cores; unsigned long eax, ebx, ecx, edx; printf ("Family: %d Model: %d Stepping: %d Type: %d Brand: %d\n", @@ -70,19 +71,32 @@ void display_Intel_info (struct cpudata if (show_bluesmoke) decode_Intel_bluesmoke(cpu->number, cpu->family); + /* Multicore detection */ + if (cpu->maxi < 4) + nr_cores = 1; + else { + cpuid_count (cpu->number, 4, 0, &eax, NULL, NULL, NULL); + nr_cores = 1 + ((eax >> 26) & 0x3f); + } + if (nr_cores > 1) + printf ("The physical package has %d cores", nr_cores); + /* Hyper-Threading Technology */ if (cpu->flags_edx & (1 << 28)) { int nr_ht; int phys_id; cpuid(cpu->number, 1, NULL, &ebx, NULL, NULL); - nr_ht = (ebx >> 16) & 0xFF; + nr_ht = ((ebx >> 16) & 0xFF) / nr_cores; phys_id = (ebx >> 24) & 0xFF; if (!nr_ht) nr_ht = 1; - printf ("The physical package supports " - "%d logical processors \n\n", nr_ht); + + if (nr_cores > 1) + printf (", with %d logical processors per core\n\n", nr_ht); + else + printf("The physical package supports %d logical processors\n\n", nr_ht); } if (show_microcode)