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)

System.Object
  Microsoft.SqlServer.Management.Smo.Cpu

public sealed class Cpu

NameDescription
System_CAPS_pubpropertyAffinityMask

Gets or sets the T:Microsoft.SqlServer.Management.Smo.AffinityMask member of the Cpu class.

System_CAPS_pubpropertyGroupID

Gets the current value of the T:Microsoft.SqlServer.Management.Smo.Cpu.GroupID member.

System_CAPS_pubpropertyID

Gets the T:Microsoft.SqlServer.Management.Smo.Cpu.ID of the CPU that is represented by this Cpu object.

System_CAPS_pubpropertyNumaNodeID

Gets the T:Microsoft.SqlServer.Management.Smo.Cpu.NumaNodeID of the NUMA node to which this Cpu object belongs.

NameDescription
System_CAPS_pubmethodEquals(Object)

(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_pubmethodToString()

(Inherited from Object.)

Access to the T:Microsoft.SqlServer.Management.Smo.CPU class is though the T:Microsoft.SqlServer.Management.Smo.Server.AffinityInfo.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.

C#

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

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

Powershell

$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.

Return to top
Show: