How to get physical CPU count on a server
With hyper-threading and multi-core CPUs, it isn't easy to find out how many physical CPUs (or sockets) there are on a server. Recently we were given such a task to ensure we were properly licensed. Since Microsoft's CPU licensing scheme is per socket, we can't just look in Task Manager or Computer Properties as we'll see the virtual CPU count. Due to this, I did some searching to find out if the number of sockets could be queried in the registry or if there was some other method available. I was unable to find any registry solution, but I was able to find three free tools. These tools are CPUCount, Process Explorer, and WinAudit.
CPUCount is a tool from Intel that detects multi-core processor topology in an IA-32 platform. It provides exactly the information that I am after but only on Intel servers. It does not provide the correct information on AMD servers with multi-core processors as seen on both of our 4-node clusters that use AMD hardware. Also, I was unclear whether it provided accurate information about 64-bit Intel servers. Due to both of these, I went searching for other tools.
CPUCount with inaccurate information on AMD hardware (our server has 4 dual-core CPUs):
Process Explorer is one of the tools available in the Sysinternals Suite, which is a collection of "utilities to help you manage, troubleshoot and diagnose your Windows systems and applications." To get to the physical CPU count, go to "System Information..." in the "View" menu. Tick the box for "Show one graph per CPU". The information is shown graphically in the "CPU Usage History" section. On one of my systems, we have 4 dual-core CPUs. Using Process Explorer, I can graphically see the 8 CPUs as well as the 4 sockets due to how it is grouped.
Process Explorer showing the correct information graphically (in red, yellow shows the sockets):
WinAudit is a tool from PXServer that reports on computer inventory and configuration. Once you launch the tool, click either the "Audit button" or the "Here" link. Since it collects a lot of information, it will take a few seconds to render. The physical CPU count is on the first page presented to us, which is "System Overview", in the "Number of Processors" field.
WinAudit showing the correct information (removed sensitive information):
There are other tools and solutions (WMI for example) that can get the physical CPU count, but I ended up using WinAudit as it not only provided accurate information on all of our servers, but it also was the easiest to use and is very lightweight.
I found these three tools while searching and came upon Scott's comments in this blog post.
Legacy Comments
Scott R.
2008-08-05 |
re: How to get physical CPU count on a server Tara, Good post on a worthwhile topic. Or to paraphrase Dorothy from “The Wizard of Oz”: Sockets and cores and threads – oh my! Kevin Kline had a similar topic on processor cores, sockets, and hyperthreading status about a year ago that I commented on in a post (http://sqlblog.com/blogs/kevin_kline/archive/2007/08/07/determining-sql-server-cores-cpus-and-hyperthreading.aspx) with a review of the same three tools mentioned in your post and comments on Windows API and WMI reporting on these topics at various OS versions. A common solution that was useful across many OS versions was important to me (versus other version-specific solutions). I am a big fan of Process Explorer, but was not able to get it to reveal the processor sockets by graphical outlining / grouping (back in my original post with v 11.0 or now with v11.20 – the latest released version, using the instructions you provided) on a 2-socket dual-core desktop running XP or on a 2-socket quad-core server running Windows Server 2003 EE (32-bit). It shows the right number of cores – just no visual grouping with thick lines between sockets and thin lines between cores within a socket. Perhaps this capability is also OS version-dependent (or platform-dependent – I noticed your example was on the x64 platform) under Process Explorer? Building on the info you shared about WinAudit, it is useful that WinAudit also reports on the cores per socket (single, dual, quad, the odd triple from AMD, etc.) in a supplementary table generated by their auditing process. Under categories, click on “Processors”, and look at the detailed information for the first processor in the field “Number Cores”. One confusion point is that it lists 4 processors in the processor details section on my dual-socket dual-core XP desktop (the correct total number of cores – not sockets), but the detailed section for each of the 4 processors states that “processor” is a dual-core (under the “Number Cores” field mentioned earlier). It would be nice if WinAudit could report on the “Number Cores” field under a “processor socket” section, where it would be more meaningful and less confusing. Let see – does the “Number Cores” field = 2 under each of the 4 “processors” mean that there are 8 cores total in this system (4 “processor details” sections listed x 2 “Number Cores”) or 4 cores total (2 sockets from the “Number of Processors” field in the summary section you mentioned x 2 “Number Cores”)? So many tools – so little time! Scott R. |
Tara
2008-08-05 |
re: How to get physical CPU count on a server Scott, I did see that blog post and its comments during my search for tools. Your comment came in very handy when I was working on the task a couple of weeks ago. I meant to link to the Kevin's blog in mine and especially highlight your comment, but obviously I forgot to do it. I will, however, do that soon by modifying this one. I only tested the tools on Windows 2003 servers, both 32-bit and 64-bit. I did not find an instance where WinAudit was wrong, although I'm sure each tool has its issues. Someone needs to develop a tool that works on all platforms, all operating systems, etc. It is very important that we get correct information so that we can license our software appropriately. Thank you! |