Posts Tagged ‘HyperThreading’

How to determine programmatically if your processor has hyperthreading, SIMD and other processing capabilities with __cpuid

September 22, 2012 1 comment

One of the machine intrinsics in Visual Studio is the __cpuid function, which returns a 4-byte array containing various bit-wise information about the processor hardware capabilities.

While all the gruesome details can be found on MSDN’s __cpuid, __cpuindex page, here is the basic principle:

int cpuinfo[4];
__cpuid(cpuinfo, 1);

bool hasHT = (cpuinfo[3] & (1 << 28)) > 0;

std::cout << "Hyperthreading on CPU is " << (hasHT? "supported" : "not supported") << std::endl;

Read more…

%d bloggers like this: