Condividi tramite


Classe Cpu

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

Gerarchia di ereditarietà

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

Spazio dei nomi  Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)

Sintassi

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

Nel tipo Cpu sono esposti i membri seguenti.

Proprietà

  Nome Descrizione
Proprietà pubblica AffinityMask Gets or sets the AffinityMask member of the Cpu class.
Proprietà pubblica GroupID Gets the current value of the GroupID member.
Proprietà pubblica ID Gets the ID of the CPU that is represented by this Cpu object.
Proprietà pubblica NumaNodeID Gets the NumaNodeID of the NUMA node to which this Cpu object belongs.

In alto

Metodi

  Nome Descrizione
Metodo pubblico Equals Ereditato da Object.
Metodo protetto Finalize Ereditato da Object.
Metodo pubblico GetHashCode Ereditato da Object.
Metodo pubblico GetType Ereditato da Object.
Metodo protetto MemberwiseClone Ereditato da Object.
Metodo pubblico ToString Ereditato da Object.

In alto

Osservazioni

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.

Esempi

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

Protezione dei thread

I membri static (Shared in Visual Basic) pubblici di questo tipo sono affidabili. Non è invece garantita la sicurezza dei membri dell'istanza.