import std.stream; import std.stdio; void main ( ) { int ht_supported = 0; int cores_per_socket = 1; asm{ mov EAX, 0; cpuid; test EAX, 0x10000000; jz NO_HYPER; mov ht_supported, 1; mov EAX, 4; cpuid; and EAX, 0xfc000000; shr EAX, 26; add EAX, 1; mov cores_per_socket, EAX; NO_HYPER:; }; if( ht_supported ) { printf( "Hyperthreading is supported and there are %d cores per cpu\n", cores_per_socket ); } else { printf( "Hyperthreading is not supported on this processor\n" ); } }