Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Detect HyperThreading
Message
From
30/03/2011 21:55:42
Joel Leach
Memorial Business Systems, Inc.
Tennessee, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Detect HyperThreading
Miscellaneous
Thread ID:
01505630
Message ID:
01505630
Views:
214
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 
Joel Leach
Microsoft Certified Professional
Blog: http://www.joelleach.net
Next
Reply
Map
View

Click here to load this message in the networking platform