EventCounter 类

定义

能够通过 EventSource 类收集非常频繁的事件的统计信息。Provides the ability to collect statistics for very frequent events through the EventSource class.

public ref class EventCounter : System::Diagnostics::Tracing::DiagnosticCounter
public ref class EventCounter
public ref class EventCounter : IDisposable
public class EventCounter : System.Diagnostics.Tracing.DiagnosticCounter
public class EventCounter
public class EventCounter : IDisposable
type EventCounter = class
    inherit DiagnosticCounter
type EventCounter = class
type EventCounter = class
    interface IDisposable
Public Class EventCounter
Inherits DiagnosticCounter
Public Class EventCounter
Public Class EventCounter
Implements IDisposable
继承
EventCounter
继承
EventCounter
实现

注解

有关如何使用类的示例 EventCounter ,请参阅 简介教程:如何使用 EventCounters 衡量经常发生的事件的性能For an example of how to use the EventCounter class, see Introduction Tutorial: How to measure performance for very frequent events using EventCounters.

构造函数

EventCounter(String, EventSource)

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

属性

DisplayName

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

(继承自 DiagnosticCounter)
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.

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 event counter instance.

ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)
WriteMetric(Double)

如果已启用性能计数器,请写入指标。Writes the metric if performance counters are on.

WriteMetric(Single)

如果已启用性能计数器,请写入指标。Writes the metric if performance counters are on.

适用于