Compartir a través de


Clase CpuCollection

The CpuCollection class represents a collection of Cpu objects that represent all the CPUs that are defined on an instance of SQL Server.

Jerarquía de herencia

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

Espacio de nombres:  Microsoft.SqlServer.Management.Smo
Ensamblado:  Microsoft.SqlServer.Smo (en Microsoft.SqlServer.Smo.dll)

Sintaxis

'Declaración
Public NotInheritable Class CpuCollection _
    Implements ICollection, IEnumerable
'Uso
Dim instance As CpuCollection
public sealed class CpuCollection : ICollection, 
    IEnumerable
public ref class CpuCollection sealed : ICollection, 
    IEnumerable
[<SealedAttribute>]
type CpuCollection =  
    class
        interface ICollection
        interface IEnumerable
    end
public final class CpuCollection implements ICollection, IEnumerable

El tipo CpuCollection expone los siguientes miembros.

Propiedades

  Nombre Descripción
Propiedad pública AffitinizedCPUs Gets an affinitized Cpu list.
Propiedad pública Count Gets the number of Cpu entries in the collection.
Propiedad pública IsSynchronized Gets a value that indicates whether the collection is synchronized with the instance of SQL Server.
Propiedad pública Item Gets a Cpu object from the collection.
Propiedad pública SyncRoot Gets the synchronization root of the CpuCollection object.

Arriba

Métodos

  Nombre Descripción
Método público CopyTo(Array, Int32) Copies the collection of objects to a one-dimensional array beginning at the specified index value.
Método público CopyTo(array<Cpu> [] () [] [], Int32) Copies the collection of objects to a one-dimensional array beginning at the specified index value.
Método público Equals (Se hereda de Object.)
Método protegido Finalize (Se hereda de Object.)
Método público GetByID Gets a Cpu object with the specified CPU ID from the collection.
Método público GetElementAt Gets a Cpu object from the specified position in the collection.
Método público GetEnumerator Gets a IEnumerator interface that can be used to iterate over the CpuCollection object.
Método público GetHashCode (Se hereda de Object.)
Método público GetType (Se hereda de Object.)
Método protegido MemberwiseClone (Se hereda de Object.)
Método público SetAffinityToAll Sets the affinity mask for all CPUs on an instance of SQL Server.
Método público SetAffinityToRange(Int32, Int32, Boolean) Sets the affinity mask for the CPUs in the specified range.
Método público SetAffinityToRange(Int32, Int32, Boolean, Boolean) Sets the affinity mask for the CPUs in the specified range.
Método público ToString (Se hereda de Object.)

Arriba

Comentarios

The methods Count,

IsSynchronized,

SyncRoot and

[T:Microsoft.SqlServer.Management.Smo.CpuCollection.CopyTo(T:System.Array,T:System.Int32)] are inherited from ICollection and IEnumerable.

Ejemplos

The following example shows how to display the ID of each CPU on an 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)");
            dbServer.Refresh();
            //Display the ID of each CPU on the instance of SQL Server.
            foreach (Cpu cpu in dbServer.AffinityInfo.Cpus)
            {
                Console.WriteLine("Cpu ID = {0}", cpu.ID);
            }
        }
    }
}

Powershell

$dbServer = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$dbServer.Refresh()

#Display the ID of each CPU on the instance of SQL Server.
Foreach ($cpu in $dbServer.AffinityInfo.Cpus)
{
   Write-Host "CPU ID =" $cpu.ID
}

Seguridad para subprocesos

Cualquier miembro público static (Shared en Visual Basic) de este tipo es seguro para subprocesos. No se garantiza que los miembros de instancia sean seguros para subprocesos.