ToxicAvenger | tetedeiench a écrit :
Si je me rapelle bien, il fallait passer par le nombre de CPU physique et le comparer au nombre de CPU logiques...
mais bon, j'aimerai bien retrouver la fonction, je sais que je l'avais trouvée sur un datasheet de chez intel, mais y en a des tonnes :-(
|
Code :
- #define HT_BIT 0x10000000 // Bit 28 indicates Hyper-Threading Technology support
- #define FAMILY_ID 0x0f00 // Bits 11 through 8 is family processor id
- #define EXT_FAMILY_ID 0x0f00000 // Bits 23 through 20 is extended family processor id
- #define PENTIUM4_ID 0x0f00 // Pentium 4 family processor id
- // Returns non-zero if Hyper-Threading Technology supported zero if not.
- // Hyper-Threading Technology still may not be enabled due to BIOS or OS settings.
- unsigned int Is_HT_Supported(void)
- {
- unsigned int reg_eax = 0;
- unsigned int reg_edx = 0;
- unsigned int vendor_id[3] = {0, 0, 0};
- __try { // verify cpuid instruction is supported
- __asm {
- xor eax, eax // call cpuid with eax = 0 (faster than mov ax, 1)
- cpuid // to get vendor id string
- mov vendor_id, ebx
- mov vendor_id + 4, edx
- mov vendor_id + 8, ecx
- mov eax, 1 // call cpuid with eax = 1
- cupid // to get the CPU family information
- mov reg_eax, eax // eax contains cpu family type info
- mov reg_edx, edx // edx has Hyper-Threading info
- }
- }
- __except (EXCEPTION_EXECUTE_HANDLER ) {
- return 0; // The CPUID call is not supported
- }
- // Is this a Pentium 4 or later processor?
- if (((reg_eax & FAMILY_ID) == PENTIUM4_ID) || (reg_eax & EXT_FAMILY_ID))
- if (vendor_id[0] == 'uneG')
- if (vendor_id[1] == 'Ieni')
- if (vendor_id[2] == 'letn')
- return (reg_edx & HT_BIT); // Intel Processor Hyper-Threading
- return 0; // The processor is not Intel.
- }
|
http://www.intel.com/cd/ids/develo [...] htm?page=3 |