我在基于i7的新机器上遇到基于CPUID的代码问题.它将CPU检测为具有8个HT单元的单个核心,而不是4个核心,每个核心具有2个HT单元.
我必须误解从CPU返回的CPUID信息的结果,但我看不出如何.
基本上,我遍历Windows可见的每个处理器,为该线程设置线程关联,然后进行一系列CPUID调用.
args = new CPUID_Args();
args.eax = 1;
executeHandler(ref args);
if (0 != (args.edx & (0x1 << 28)))
{
//If the 28th bit in EDX is flagged, this processor supports multiple logical processors per physical package
// in this case bits 23:16 of EBX should give the count.
//** EBX here is 0x2100800
logicalProcessorCount = (args.ebx & 0x00FF0000) >> 16;
//** this tells me there are 16 logical processors (wrong)
}
else
{ logicalProcessorCount = 1; }
apic …Run Code Online (Sandbox Code Playgroud)