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 继承。)
公共方法 GetHashCode (从 Object 继承。)
公共方法 GetType (从 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

线程安全

此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。不保证所有实例成员都是线程安全的。

请参阅

参考

Microsoft.SqlServer.Management.Smo 命名空间