PollingCounter 類別

定義

提供 EventCounter 的變化,其收集和計算與 EventCounter 相似的統計資料。

public ref class PollingCounter : System::Diagnostics::Tracing::DiagnosticCounter
public class PollingCounter : System.Diagnostics.Tracing.DiagnosticCounter
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public class PollingCounter : System.Diagnostics.Tracing.DiagnosticCounter
type PollingCounter = class
    inherit DiagnosticCounter
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
type PollingCounter = class
    inherit DiagnosticCounter
Public Class PollingCounter
Inherits DiagnosticCounter
繼承
PollingCounter
屬性

備註

PollingCounter 是的 EventCounter 變體,其會使用回呼方法來輪詢值,而不要求寫入器在每次追蹤值時明確呼叫 EventCounter.WriteMetricmetricProvider 是輪詢值的回呼方法。 實例會 PollingCounter 根據接聽程式所要求的間隔,輪詢和報告擷取 metricProvider 的值。

PollingCounter只要EventSource附加至 的 ,除非明確處置它。

PollingCounter 不同於 EventCounter ,它會使用回呼函式自行收集計量,而不是要求使用者每次呼叫 WriteMetric

如需在運行時間內用於 PollingCounter 運行時間性能計數器的範例,請參閱 GitHub 上的 RuntimeEventSource CoreCLR 來源。

建構函式

PollingCounter(String, EventSource, Func<Double>)

初始化 PollingCounter 類別的新執行個體。

屬性

DisplayName

取得或設定計數器的顯示名稱。

(繼承來源 DiagnosticCounter)
DisplayUnits

取得或設定計數器的顯示單位。

(繼承來源 DiagnosticCounter)
EventSource

取得此計數器所附加的 EventSource。

(繼承來源 DiagnosticCounter)
Name

取得此計數器的名稱。

(繼承來源 DiagnosticCounter)

方法

AddMetadata(String, String)

將索引鍵/值中繼資料新增至將作為承載一部分的計數器。

(繼承來源 DiagnosticCounter)
Dispose()

EventSource 報告的集合中移除計數器。

(繼承來源 DiagnosticCounter)
Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回目前輪詢計數器執行個體的字串表示。

適用於

另請參閱