Check if HyperThreading is Enabled on Your Windows Server


It turns out that our datacentre guys had HyperThreading not turned on in our Oracle Database Server. We’re talking about ~30% improvement in performance with it turned on. Here’s a quick way to check if HyperThreading is enabled in Windows.

It uses the fact that when hyperthreading is enabled, the number of logical processors will be higher than number of cores.

Copy the below code and save it as ht_check.vbs

To run, open a command prompt, cd to the location you have the script saved (or use full path) and call
cscript ht_check.vbs


strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set Plist = objWMIService.ExecQuery _
("Select * from Win32_Processor")
For Each prox in Plist
IF prox.NumberOfLogicalProcessors > prox.NumberOfCores THEN
Wscript.Echo "HYPERTHREADING ENABLED!"
Wscript.Echo "Num of Logical Procs:" + CStr(prox.NumberOfLogicalProcessors)
Wscript.Echo "Num of Cores:" + CStr(prox.NumberOfCores)
ELSE
Wscript.Echo "HYPERTHREADING NOT ENABLED!"
Wscript.Echo "Num of Logical Procs:" + CStr(prox.NumberOfLogicalProcessors)
Wscript.Echo "Num of Cores:" + CStr(prox.NumberOfCores)
END IF
Next

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s