IncrementingPollingCounter 类

定义

为不断增大的变量提供 EventCounter 的变体,例如运行时中的异常数。Provides a variant of EventCounter for variables that are ever-increasing, such as the number of exceptions in the runtime.

public ref class IncrementingPollingCounter : System::Diagnostics::Tracing::DiagnosticCounter
public class IncrementingPollingCounter : System.Diagnostics.Tracing.DiagnosticCounter
type IncrementingPollingCounter = class
    inherit DiagnosticCounter
Public Class IncrementingPollingCounter
Inherits DiagnosticCounter
继承
IncrementingPollingCounter

注解

IncrementingPollingCounter 对象,只要它们附加到的 EventSource,除非显式释放。IncrementingPollingCounter objects live as long as the EventSource that they are attached to unless they are explicitly disposed.

totalValueProvider 是一种用于按侦听器指定的间隔轮询值的方法。totalValueProvider is a method used for polling the values at the interval specified by the listener. 此方法应返回递增的 float 值;否则,可能会报告负值的增量。This method is expected to return an incrementing float value; otherwise, an increment of a negative value may be reported.

IncrementingPollingCounter 不会计算平均值和标准偏差等统计信息,因为它只累积计数器值。IncrementingPollingCounter does not calculate statistics like mean and standard deviation because it only accumulates the counter value. IncrementingEventCounter不同,这将采用轮询回调,它可以调用来定期更新其自己的度量值。Unlike IncrementingEventCounter, this takes in a polling callback that it can call to update its own metric periodically.

有关使用运行时中的 IncrementingPollingCounter 作为运行时性能计数器的示例,请参阅 GitHub 上的RuntimeEventSource的 CoreCLR 源。For an example that uses IncrementingPollingCounter inside the runtime as for runtime performance counters, see the CoreCLR source for RuntimeEventSource on GitHub.

构造函数

IncrementingPollingCounter(String, EventSource, Func<Double>)

初始化 IncrementingPollingCounter 类的新实例。Initializes a new instance of the IncrementingPollingCounter class.

属性

DisplayName

获取或设置计数器的显示名称。Gets or sets the display name of the counter.

(继承自 DiagnosticCounter)
DisplayRateTimeScale

获取或设置此指标应显示为的速率。Gets or sets rate at which this metric should be displayed as.

DisplayUnits

获取或设置计数器的显示单位。Gets or sets the display units of the counter.

(继承自 DiagnosticCounter)
EventSource

获取此计数器附加到的 EventSource。Gets the EventSource that this counter is attached to.

(继承自 DiagnosticCounter)
Name

获取此计数器的名称。Gets the name of this counter.

(继承自 DiagnosticCounter)

方法

AddMetadata(String, String)

将键值元数据添加到包含在有效负载中的计数器。Adds key-value metadata to the counter that will be included as a part of the payload.

(继承自 DiagnosticCounter)
Dispose()

EventSource 将报告的集合中删除计数器。Removes the counter from the set that the EventSource will report on.

(继承自 DiagnosticCounter)
Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回当前递增轮询计数器实例的字符串表示形式。Returns a string representation of the current incrementing polling counter instance.

适用于