CounterSet.AddCounter 方法

定义

向计数器集中添加计数器。

重载

AddCounter(Int32, CounterType)

使用指定的计数器标识符和类型向计数器集中添加计数器。

AddCounter(Int32, CounterType, String)

使用指定的计数器标识符和类型以及计数器的显示名称向计数器集中添加计数器。

AddCounter(Int32, CounterType)

Source:
CounterSet.cs
Source:
CounterSet.cs
Source:
CounterSet.cs

使用指定的计数器标识符和类型向计数器集中添加计数器。

public:
 void AddCounter(int counterId, System::Diagnostics::PerformanceData::CounterType counterType);
public void AddCounter (int counterId, System.Diagnostics.PerformanceData.CounterType counterType);
member this.AddCounter : int * System.Diagnostics.PerformanceData.CounterType -> unit
Public Sub AddCounter (counterId As Integer, counterType As CounterType)

参数

counterId
Int32

标识计数器。 使用在清单中所用的值来定义计数器。

counterType
CounterType

标识计数器类型。 计数器类型用来确定如何计算和显示计数器数据以及如何对其求平均值。

例外

计数器标识符已经存在于计数器集中、计数器标识符为负数,或者计数器类型为 NULL 或无效。

在为计数器集创建实例之后,将无法向其中添加计数器。

注解

在为计数器集创建实例之前,必须先向其中添加计数器。

适用于

AddCounter(Int32, CounterType, String)

Source:
CounterSet.cs
Source:
CounterSet.cs
Source:
CounterSet.cs

使用指定的计数器标识符和类型以及计数器的显示名称向计数器集中添加计数器。

public:
 void AddCounter(int counterId, System::Diagnostics::PerformanceData::CounterType counterType, System::String ^ counterName);
public void AddCounter (int counterId, System.Diagnostics.PerformanceData.CounterType counterType, string counterName);
member this.AddCounter : int * System.Diagnostics.PerformanceData.CounterType * string -> unit
Public Sub AddCounter (counterId As Integer, counterType As CounterType, counterName As String)

参数

counterId
Int32

标识计数器。 使用在清单中所用的值来定义计数器。

counterType
CounterType

标识计数器类型。 计数器类型用来确定如何计算和显示计数器数据以及如何对其求平均值。

counterName
String

计数器的名称。 可以使用此名称来为该计数器集实例中的计数器编制索引。 (请参阅Item[String].)

例外

计数器标识符已经存在于计数器集中、计数器标识符为负数,或者计数器类型为 NULL 或无效。

在为计数器集创建实例之后,将无法向其中添加计数器。

示例

有关示例,请参见 System.Diagnostics.PerformanceData

注解

在为计数器集创建实例之前,必须先向其中添加计数器。

适用于