Gets a performance counter for the specified name. Namespace: Microsoft.ConfigurationManagement.AdminConsole.Common
Assembly: Microsoft.ConfigurationManagement.ManagementProvider (in microsoft.configurationmanagement.managementprovider.dll)

Usage

Visual Basic
Dim performanceCounterName As String
Dim returnValue As PerformanceCounter

returnValue = UtilityClass.GetPerformanceCounterInstance(performanceCounterName)

Syntax

Visual Basic
<PermissionSetAttribute(SecurityAction.LinkDemand, Name:="FullTrust")> _
<PermissionSetAttribute(SecurityAction.InheritanceDemand, Name:="FullTrust")> _
Public Shared Function GetPerformanceCounterInstance ( _
		performanceCounterName As String _
) As PerformanceCounter
C#
[PermissionSetAttribute(SecurityAction.LinkDemand, Name="FullTrust")] 
[PermissionSetAttribute(SecurityAction.InheritanceDemand, Name="FullTrust")] 
public static PerformanceCounter GetPerformanceCounterInstance (
		string performanceCounterName
)
C++
[PermissionSetAttribute(SecurityAction::LinkDemand, Name=L"FullTrust")] 
[PermissionSetAttribute(SecurityAction::InheritanceDemand, Name=L"FullTrust")] 
public:
static PerformanceCounter^ GetPerformanceCounterInstance (
		String^ performanceCounterName
)
J#
/** @attribute PermissionSetAttribute(SecurityAction.LinkDemand, Name="FullTrust") */ 
/** @attribute PermissionSetAttribute(SecurityAction.InheritanceDemand, Name="FullTrust") */ 
public static PerformanceCounter GetPerformanceCounterInstance (
		String performanceCounterName
)
JScript
public static function GetPerformanceCounterInstance (
		performanceCounterName : String
) : PerformanceCounter

Parameters

performanceCounterName

[in] Name of a performance counter.

Return Value

System.Diagnostics.PerformanceCounter object.

Exceptions

Exception type Condition
ArgumentOutOfRangeException

The requested performance counter could not be found.

Remarks

Performance counter objects are created and retrieved on demand, whenever the Configuration Manager console requests them.


Thread Safety

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

Platforms

Development Platforms

Windows Server 2003, Windows Vista

Target Platforms

Windows Server 2003,Windows Vista

See Also