Finding # of Physical Processors

  • Recently I was asked to provide some information about our SQL Server environment for the purpose of "truing-up" the license count and as input into budget needs, etc. So, I wrote a quick script (below) which provide most of what I need. When combined with a osql -L cursor loop I can get quite a bit of information  into an agregate report.

    My question is: is there a way to get the physical porcessor count on a server? The counts that I'm finding not only include the physical processors but also the hyperthreaded logical processors (which don't come in to play with licensing). Barring a way to get the actual physical count - is there a way to know that a processor(s) has been hyperthreaded?

    Thanks

    Glenn

    --===========================================================

    -- This script will provide a one-line information summary

    -- about the database server instance.

    --===========================================================

    DECLARE

    @mdac varchar(20)

    DECLARE @ProcessorCount varchar(4)

    DECLARE @processor varchar(100)

    DECLARE @Memory varchar(20)

    DECLARE @RegisteredProcessors int

    EXEC

    master..xp_regread

       @rootkey='HKEY_LOCAL_MACHINE',

       @key='Software\Microsoft\DataAccess',

       @value_name='Version',

       @value=@mdac OUTPUT

    EXEC

    master..xp_regread

       @rootkey='HKEY_LOCAL_MACHINE',

       @key='System\CurrentControlSet\Control\Session Manager\Environment',

       @value_name='NUMBER_OF_PROCESSORS',

       @value=@ProcessorCount OUTPUT

    EXEC

    master..xp_regread

       @rootkey='HKEY_LOCAL_MACHINE',

       @key='System\CurrentControlSet\Control\Session Manager',

       @value_name='RegisteredProcessors',

       @value=@RegisteredProcessors OUTPUT

    select

      

    convert(varchar(20),serverproperty('machinename')) as [Server],

       convert(varchar(20),serverproperty('servername')) as [Instance],

       convert(varchar(30),replace(substring(@@version,1,charindex('-',@@version) - 2),' ',' ')) as [Product],

       convert(varchar(30),serverproperty('edition')) as [Edition],

       convert(varchar(6),serverproperty('productlevel')) as [SP],

       convert(varchar(20),serverproperty('productversion')) as [Version],

       convert(varchar(20),serverproperty('licensetype')) as [License],

       convert(varchar(10),serverproperty('numlicenses')) as [#Licenses],

       Convert(varchar(20),

          CASE serverproperty('isclustered')

             WHEN 1 THEN 'Clustered'

             ELSE 'Not Clustered'

       END) AS [Is Clustered],

       convert(varchar(15),@ProcessorCount) AS Processors,

       convert(varchar(15),@RegisteredProcessors) AS [Reg Processors],

       convert(varchar(20),@mdac) as [MDAC]

     

  • Not that I've ever found. Hyperthreading is a real pain when it comes to licensing - even the Windows information makes it look like you've got twice as many processors as you actually have! The only way I've found to date (which is no help to you whatsoever!) is to go and open the box and look inside!

  • Check the article:

    SQL Server support in a hyper-threaded environment

    http://support.microsoft.com/kb/322385

     

    and try

    Intel provides a CPU counting utility. CPUCount.exe

  • Thanks for the replies.

    After having looked at the linked article previously... The question  is not how to, or the benefits of, hyperthreading (we already do it). Rather how to obtain the actual physical count of processors in a given server.

    It seems odd that the registry would have no information as to this information and/or if hyperthreading was even involked.

    Glenn

  • use the

     CPU counting utility. CPUCount.exe

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply