THE SQL Server Blog Spot on the Web

Welcome to - The SQL Server blog spot on the web Sign in | |
in Search

Kevin Kline

Determining SQL Server Cores, CPUs, and Hyperthreading

Over the years, I've heard people mention that they wanted a way to determine the physical processor configuration on a machine, for example, how many cores are on the server, is hyperthreading enabled, etc.

The good news is that uber-genius of the SQL Server engine, Slava Oks, has published a blog entry on this a while back with a reference to several utilities which will give you this information.  You can find Slava's blog entry on this here:

I encourage you to make this a part of your reading!



Published Tuesday, August 7, 2007 9:27 AM by KKline
Filed under: ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS



Scott R. said:


Thanks for your post and reference to Slava’s post on utilities and APIs to reveal processor characteristics such as sockets, cores, hyper-threads, etc.

Slava’s post refers to two approaches:

-  Use of the GetLogicalProcessorInformation API: Note that while the API is present in Windows Server 2003 (but not earlier OS versions), a number of the useful fields are not available until Windows Vista or Windows Server 2008, potentially limiting its usefulness.

-  Use of the Sysinternals Process Explorer utility: I am a big fan of Process Explorer (and most everything that Sysinternals / Mark Russinovich has published and contributed so generously to the IT community), but I was not aware of the processor characteristic capabilities in Process Explorer that Slava mentioned in his post.  I downloaded the latest copy of Process Explorer from the Sysinternals site at Microsoft (in the event this feature was a recent addition), and followed Slava’s instructions (using menu View / System Information).  While there is useful info in this dialog, I didn’t find anything related to identifying cores, hyper-threads, etc.  Maybe I missed something, or went to the wrong dialog – straighten me out here.

I have been down this path (of looking for useful APIs and utilities to identify and reveal processor characteristics) over the past year or two, and will share my findings:

-  The WMI APIs (which I have used extensively in a number of scripts) have the same limitations as the GetLogicalProcessorInformation API – legacy support in current and older OS versions.  If I can only use this solution with Windows Vista or Windows Server 2008, it has limited usefulness on the more predominant deployed OS versions for the foreseeable future.  It would be great if Microsoft made these capabilities available to current and older OS versions (especially through automatic inclusion via Windows Update or similar, for consistent availability), but I don’t control those policies.

When I can’t use the WMI APIs for a given solution, I resort to separate utilities and redirect / parse the output for my needs.  I prefer solutions that can work across a broad range of OS versions, where possible.

-  Intel has a free utility called CPUCount.exe (see link: that reports on sockets, cores, hyper-threads, hyper-threading status, etc.  It works great on Intel processors (Pentium 4 and newer - does not work on older Inter processors such as Pentium III).  I believe I have tested it on Intel single / dual / quad-core systems (with and without hyper-threading), with what appears to be accurate results.  It will run on AMD processors, but can give inaccurate information on AMD multi-core processors.  For example, it states a 4-socket dual-core system as an 8-socket single-core system (right total number of cores, but wrong total number of sockets and wrong number of cores per socket).  The utility only offers console text output.  I use scripts to parse the text output and extract the key information to feed into a reporting system.

CPUCount uses the CPUID instructions to get the processor characteristics.

The link has downloads for both the exe version (ready to run) and the C++ source code (to better understand how the information was obtained, or to modify / port).

-  A free utility called WinAudit (see link: gives comprehensive processor characteristic information, including cache size / status / configuration (L1 / L2 / L3) and other specific processor capabilities.  I am still testing this utility on different systems, but so far it looks pretty good.  The utility offers many forms of output, including HTML, PDF, XML, and text (CSV).  I hope to use scripts to parse the text output and extract the key information to feed into a reporting system (as with Intel CPUCount.exe).  WinAudit offers a wide range of system information beyond processor characteristics, and will be in my toolbox for many other uses.

If WinAudit checks out as I expect, I plan to supersede use of CPUCount with WinAudit in my reporting application (for more consistent and reliable results across different processor vendors and models).

There are certainly other utilities out there that may offer similar capabilities.  These are the ones I have explored and found most useful so far.

Besides the immediate value in knowing the technical details of processor characteristics, there is value in accurately knowing the processor characteristics (sockets / cores / etc.) for software licensing purposes (and not paying more for a license than is needed).

Without the use of tools such as those described, my experience has been that inaccurate information is often communicated on these topics, with possible financial and performance consequences.

Let us know if you find other resources on this topic.  Thanks again for the post.

Scott R.

August 7, 2007 1:19 PM

Scott R. said:

Scott R.:

First, I'm not mocking you; my name happens to be Scott R. as well.

Second, I had the same problem finding the core/HT information in Process Explorer.  It turns out, if you tick the checkbox to show one graph per CPU, and you mouse-over the graphs, it tells you which CPU/Core/virt CPU that graph is for.  (E.g. on one of my systems it says (on each graph): CPU 0 (Core 0), CPU 1 (Core 1), CPU 2 (Core 0), CPU 3 (Core 1).

I don't have an HT-enabled system, but I'm assuming it would say something like CPU 0 (vCore 1) if I did.

Thanks for the tip on the Intel utility, btw.

-_Scott R.

October 22, 2007 1:05 PM

Ryan Riehle said:

The Sysinternals group also puts out a nice tool that uses the GetLogicalProcessorInfo API and runs on Windows XP SP3 and higher and Windows Server 2003 and higher; It is a command line tool. The output is clear and looks easy to parse:

March 15, 2012 3:58 PM

Leave a Comment


About KKline

Kevin Kline is a well-known database industry expert, author, and speaker. Kevin is a long-time Microsoft MVP and was one of the founders of PASS,

This Blog



Privacy Statement