Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
The Cpus member is a collection that represents the CPU settings for all CPUs on an Instance of SQL Server.
Namespace: Microsoft.SqlServer.Management.Smo
Assembly: Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)
Syntax
'Declaration
Public ReadOnly Property Cpus As CpuCollection
Get
'Usage
Dim instance As AffinityInfo
Dim value As CpuCollection
value = instance.Cpus
public CpuCollection Cpus { get; }
public:
property CpuCollection^ Cpus {
CpuCollection^ get ();
}
member Cpus : CpuCollection
function get Cpus () : CpuCollection
Eigenschaftswert
Typ: Microsoft.SqlServer.Management.Smo.CpuCollection
Returns a CPUCollection.
Hinweise
Access to the Cpus collection is provided though the [T:Microsoft.SqlServer.Management.Smo.AffinityInfo.] member of the Server object.
Beispiele
This example shows you how to create and display the CPU information for all CPUs on the local instance of SQL Server.
using System;
using Microsoft.SqlServer.Management.Smo;
namespace samples
{
class Program
{
static void Main(string[] args)
{
Server dbServer = new Server("(local)");
dbServer.Refresh();
Console.WriteLine("Total CPUs: {0}\n", dbServer.AffinityInfo.Cpus.Count);
foreach (Cpu cpu in dbServer.AffinityInfo.Cpus)
{
Console.WriteLine("cpu.ID: {0}\n" +
"cpu.GroupID: {1}\n" +
"cpu.AffinityMask: {2}\n" +
"cpu.NumaNodeID: {3}\n",
cpu.ID,
cpu.GroupID,
cpu.AffinityMask,
cpu.NumaNodeID);
}
}
}
}
Powershell
#Create the server.
$dbServer = new-Object Microsoft.SqlServer.Smo.Server("(local)")
$dbServer.Refresh()
Write-Host "Total CPUs: Microsoft.SqlServer.Smo`n, $dbServer.AffinityInfo.Cpus.Count"
Foreach ($cpu in $dbServer.AffinityInfo.Cpus)
{
Write-Host $cpu
}