Класс Cpu

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

Иерархия наследования

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

Пространство имен:  Microsoft.SqlServer.Management.Smo
Сборка:  Microsoft.SqlServer.Smo (в Microsoft.SqlServer.Smo.dll)

Синтаксис

'Декларация
Public NotInheritable Class Cpu
'Применение
Dim instance As Cpu
public sealed class Cpu
public ref class Cpu sealed
[<SealedAttribute>]
type Cpu =  class end
public final class Cpu

Тип Cpu обеспечивает доступ к следующим элементам.

Свойства

  Имя Описание
Открытое свойство AffinityMask Gets or sets the AffinityMask member of the Cpu class.
Открытое свойство GroupID Gets the current value of the GroupID member.
Открытое свойство ID Gets the ID of the CPU that is represented by this Cpu object.
Открытое свойство NumaNodeID Gets the NumaNodeID of the NUMA node to which this Cpu object belongs.

В начало

Методы

  Имя Описание
Открытый метод Equals (Производный от Object.)
Защищенный метод Finalize (Производный от Object.)
Открытый метод GetHashCode (Производный от Object.)
Открытый метод GetType (Производный от Object.)
Защищенный метод MemberwiseClone (Производный от Object.)
Открытый метод ToString (Производный от 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.

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

Безопасность многопоточности

Любые открытые статический (Shared в Visual Basic) элементы этого типа потокобезопасны. Потокобезопасность с элементами экземпляров не гарантируется.