TechNet
Export (0) Print
Expand All

CpuCollection Class

 

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

Namespace:   Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)

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

[DefaultMemberAttribute("Item")]
public sealed class CpuCollection : ICollection, IEnumerable

NameDescription
System_CAPS_pubpropertyAffitinizedCPUs

Gets an affinitized Cpu list.

System_CAPS_pubpropertyCount

Gets the number of Cpu entries in the collection.

System_CAPS_pubpropertyIsSynchronized

Gets a value that indicates whether the collection is synchronized with the instance of SQL Server.

System_CAPS_pubpropertyItem[Int32]

Gets a Cpu object from the collection.

System_CAPS_pubpropertySyncRoot

Gets the synchronization root of the CpuCollection object.

NameDescription
System_CAPS_pubmethodCopyTo(Array, Int32)

Copies the collection of objects to a one-dimensional array beginning at the specified index value.

System_CAPS_pubmethodCopyTo(Cpu[], Int32)

Copies the collection of objects to a one-dimensional array beginning at the specified index value.

System_CAPS_pubmethodEquals(Object)

(Inherited from Object.)

System_CAPS_pubmethodGetByID(Int32)

Gets a Cpu object with the specified CPU ID from the collection.

System_CAPS_pubmethodGetElementAt(Int32)

Gets a Cpu object from the specified position in the collection.

System_CAPS_pubmethodGetEnumerator()

Gets a T:System.IEnumerator interface that can be used to iterate over the CpuCollection object.

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_pubmethodSetAffinityToAll(Boolean)

Sets the affinity mask for all CPUs on an instance of SQL Server.

System_CAPS_pubmethodSetAffinityToRange(Int32, Int32, Boolean)

Sets the affinity mask for the CPUs in the specified range.

System_CAPS_pubmethodSetAffinityToRange(Int32, Int32, Boolean, Boolean)

Sets the affinity mask for the CPUs in the specified range.

System_CAPS_pubmethodToString()

(Inherited from Object.)

The methods T:Microsoft.SqlServer.Management.Smo.CpuCollection.Count,

T:Microsoft.SqlServer.Management.Smo.CpuCollection.IsSynchronized,

T:Microsoft.SqlServer.Management.Smo.CpuCollection.SyncRoot and

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

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
}

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft