I have a Intel Core i5-2450m (2 physical processors and 4 logical processors) and I want to find a way to count logical and physical cores on AMD and Intel CPUs. But, after some searches I noticed something strange. Instead of returning 4 logical units, my code give me 16.
static int8_t LogicalProcCount(void)
{
if ( !Hyperthreading )
return 1;
uint32_t unused, ebx;
CPUID(1, unused, ebx, unused, unused);
return (int8_t) ( (ebx >> 16 ) & 0xFF );
}