Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Detect HyperThreading
Message
From
31/03/2011 10:06:28
 
 
To
30/03/2011 21:55:42
Joel Leach
Memorial Business Systems, Inc.
Tennessee, United States
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01505630
Message ID:
01505700
Views:
49
Hi Joel,
the script works fine on my machine:

Windows 7 Enterprise 32bit on ThinkPad L512

CPU Manufacturer: GenuineIntel
CPU Name: Intel(R) Core(TM) i5 CPU M 480 @ 2.67GHz
Number of Physical Cores: 2
Number of Logical Processors: 4
Hyperthreading is ENABLED

>I wrote a program to detect HyperThreading (HT) using WMI. Would you mind testing on your machine(s)? It only works on Windows XP SP3, Windows Server 2003, and later, because that is when MS introduced the required APIs. Other than that, the only requirement is that you actually know whether or not your hardware supports HT. I would like this tested on machines that have HT and those that don't, but please report which you have with your results. Thanks! I appreciate the help.
>
>
>* Use WMI to determine if HyperThreading is turned on
>* This only works on Windows XP SP3, Windows Server 2003, and later because
>*	underlying Windows APIs were not added until those versions.
>Local lcWMIFolder, loWMI, lcolProcessors, loProcessor
>
>lcWMIFolder = Addbs(GetEnv("SystemRoot")) + "System32\WBEM\"
>If Directory(lcWMIFolder)	&& make sure installed
>	loWMI = GetObject("winmgmts:\\.\root\cimv2")
>	lcolProcessors = loWMI.ExecQuery("Select * from Win32_Processor")
>	For each loProcessor in lcolProcessors FoxObject
>		If Type("loProcessor.NumberOfCores")<> "U" and Type("loProcessor.NumberOfLogicalProcessors")<> "U"
>			? "CPU Manufacturer:", loProcessor.Manufacturer
>			? "CPU Name:", loProcessor.Name
>			? "Number of Physical Cores:", loProcessor.NumberOfCores
>			? "Number of Logical Processors:", loProcessor.NumberOfLogicalProcessors
>			* If logical processors > actual cores, HT must be turned on
>			If loProcessor.NumberOfLogicalProcessors > loProcessor.NumberOfCores
>				? "HyperThreading is ENABLED"
>			Else
>				? "HyperThreading is DISABLED or unavailable on CPU"
>			EndIf 
>		Else
>			? "HyperThreading detection not available on this O/S"
>		EndIf 
>	EndFor 
>Else
>	? "WMI is not installed."
>EndIf 
>
Best Regards
-Tom

Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.

Oh, and BTW: 010101100100011001010000011110000101001001101111011000110110101101110011
Previous
Reply
Map
View

Click here to load this message in the networking platform