CounterSet.AddCounter 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
會為計數器組新增一個計數器。
多載
| 名稱 | Description |
|---|---|
| AddCounter(Int32, CounterType) |
透過使用指定的計數器識別碼與類型,將計數器加入計數器集。 |
| AddCounter(Int32, CounterType, String) |
透過使用指定的計數器識別碼與類型,以及計數器的顯示名稱,為計數器集新增一個計數器。 |
AddCounter(Int32, CounterType)
透過使用指定的計數器識別碼與類型,將計數器加入計數器集。
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)
透過使用指定的計數器識別碼與類型,以及計數器的顯示名稱,為計數器集新增一個計數器。
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。
備註
你必須先將計數器加入該計數器集,才能建立該計數器集合的實例。