Classe Cpu

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

Hiérarchie d'héritage

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

Espace de noms :  Microsoft.SqlServer.Management.Smo
Assembly :  Microsoft.SqlServer.Smo (en Microsoft.SqlServer.Smo.dll)

Syntaxe

'Déclaration
Public NotInheritable Class Cpu
'Utilisation
Dim instance As Cpu
public sealed class Cpu
public ref class Cpu sealed
[<SealedAttribute>]
type Cpu =  class end
public final class Cpu

Le type Cpu expose les membres suivants.

Propriétés

  Nom Description
Propriété publique AffinityMask Gets or sets the AffinityMask member of the Cpu class.
Propriété publique GroupID Gets the current value of the GroupID member.
Propriété publique ID Gets the ID of the CPU that is represented by this Cpu object.
Propriété publique NumaNodeID Gets the NumaNodeID of the NUMA node to which this Cpu object belongs.

Haut de la page

Méthodes

  Nom Description
Méthode publique Equals (hérité de Object.)
Méthode protégée Finalize (hérité de Object.)
Méthode publique GetHashCode (hérité de Object.)
Méthode publique GetType (hérité de Object.)
Méthode protégée MemberwiseClone (hérité de Object.)
Méthode publique ToString (hérité de Object.)

Haut de la page

Notes

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.

Exemples

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

Sécurité des threads

Tous les membres publics static (Shared dans Visual Basic) de ce type sont thread-safe. Tous les membres de l'instance ne sont pas garantis comme étant thread-safe.