Determine physical CPU count for a computer using C#
Posted on 2006-11-25
I am writing a simple asset management application to collect information about remote computers and store the information in a database for reporting. I am mostly using WMI to collect the information.
The issue I am having is that no matter how I try to collect the CPU count, I get back incorrect information. Because of the introduction of Hyperthreading and Dual Core CPUs, the CPU counts show double or even quadruple CPU counts. For example, if a computer has 2 physical CPUs and have hyperthreading enabled, the CPU count will show as 4 CPUs. If the same computer is using Dual Core CPUs with Hyperthreading enabled, the CPU count will be 8. This is the number shown anywhere you look in the operating system is also skewed by dual core and hyperthreaded CPUs.
Does anyone have any idea of a way I can determine the real physical CPU count?
Thanks in adavance!