Cpu Class

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

Inheritance Hierarchy

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

Namespace:  Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)

Syntax

'Declaration
Public NotInheritable Class Cpu
'Usage
Dim instance As Cpu
public sealed class Cpu
public ref class Cpu sealed
[<SealedAttribute>]
type Cpu =  class end
public final class Cpu

The Cpu type exposes the following members.

Properties

  Name Description
Public property AffinityMask Gets or sets the AffinityMask member of the Cpu class.
Public property GroupID Gets the current value of the GroupID member.
Public property ID Gets the ID of the CPU that is represented by this Cpu object.
Public property NumaNodeID Gets the NumaNodeID of the NUMA node to which this Cpu object belongs.

Top

Methods

  Name Description
Public method Equals (Inherited from Object.)
Public method GetHashCode (Inherited from Object.)
Public method GetType (Inherited from Object.)
Public method ToString (Inherited from Object.)

Top

Remarks

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.

Examples

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

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.SqlServer.Management.Smo Namespace