Surya kumar(deleted)
|
Re: How to check hyperthreading status using CPUID
|
Surya kumar(deleted)
11/27/2018 2:14 AM
post119308
|
Re: How to check hyperthreading status using CPUID
> I found this instruction from one of the intel documentation on how to check
> hyperthreading(HTT) support.
> "To determine if Hyper-Threading Technology is supported, check the value
> returned in EBX[23:16] after executing
> CPUID with EAX=1. If EBX[23:16] contains a value >1, then the processor
> supports Hyper-Threading Technology"
>
> I am using below code to check the same:
>
> void cpu_ID(unsigned int Info, unsigned int ui[4]) {
> __asm__ __volatile__("cpuid" : "=a" (ui[0]), "=b" (ui[1]), "=c" (ui[2]), "
> =d" (ui[3]) : "a" (ui), "c" (0));
>
> }
>
>
> int main()
> {
>
> cpuID(1, Info);
> logicalCores = (ui[1] >> 16) & 0xff; // EBX[23:16]
> printf("logicl core %d \n",logicalCores);
>
> }
>
>
> I always get logical cores greater than 1.
> If i search the featurs of my processer online it is mentioned that Hyper
> threading is NOT SUPPORTED.
>
> Is there any mistake the way am using CPUID and calculation.
> Also please let me know if there is a better alternative for
> checking if system has HTT support and weather it is enabled or disabled.
>
> Thank you for the support
I was not able to edit the above code i posted so i am posting the code in reply ::
void cpu_ID(unsigned int Info, unsigned int ui[4]) {
__asm__ __volatile__("cpuid" : "=a" (ui[0]), "=b" (ui[1]), "=c" (ui[2]), "=d" (ui[3]) : "a" (info), "c" (0));
}
int main()
{
unsigned int ui[4];
cpuID(1, ui);
logicalCores = (ui[1] >> 16) & 0xff; // EBX[23:16]
printf("logicl core %d \n",logicalCores);
}
|
|
|