Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Cpu Class

The Cpu class contains information about one CPU on an instance of SQL Server.


Namespace:  Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)
public sealed class Cpu

The Cpu type exposes the following members.

Public propertyAffinityMaskGets or sets the AffinityMask member of the Cpu class.
Public propertyGroupIDGets the current value of the GroupID member.
Public propertyIDGets the ID of the CPU that is represented by this Cpu object.
Public propertyNumaNodeIDGets the NumaNodeID of the NUMA node to which this Cpu object belongs.
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)

Access to the CPU class is though the Cpus collection property.

To change the CPU settings on an instance of SQL Server, users must have ALTER permission on the database.

The following code example displays the total number of CPUs on the local instance of SQL Server.


using System;
using Microsoft.SqlServer.Management.Smo;

namespace samples
    class Program
        static void Main(string[] args)
            Server dbServer = new Server("(local)");
                "Total number of CPUs for server {0} is {1}.",


$dbServer = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
Write-Host "Total number of CPUs for server" $dbServer.Name "is" $dbServer.AffinityInfo.Cpus.Count
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.