EventCounter Class

Definition

Provides the ability to collect statistics for very frequent events through the EventSource class.

C#
public class EventCounter : System.Diagnostics.Tracing.DiagnosticCounter
C#
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public class EventCounter : System.Diagnostics.Tracing.DiagnosticCounter
C#
public class EventCounter
C#
public class EventCounter : IDisposable
Inheritance
EventCounter
Inheritance
EventCounter
Attributes
Implements

Remarks

For an example of how to use the EventCounter class, see Introduction Tutorial: How to measure performance for very frequent events using EventCounters.

Constructors

EventCounter(String, EventSource)

Initializes a new instance of the EventCounter class.

Properties

DisplayName

Gets or sets the display name of the counter.

(Inherited from DiagnosticCounter)
DisplayUnits

Gets or sets the display units of the counter.

(Inherited from DiagnosticCounter)
EventSource

Gets the EventSource that this counter is attached to.

(Inherited from DiagnosticCounter)
Name

Gets the name of this counter.

(Inherited from DiagnosticCounter)

Methods

AddMetadata(String, String)

Adds key-value metadata to the counter that will be included as a part of the payload.

(Inherited from DiagnosticCounter)
Dispose()

Removes the counter from the set that the EventSource will report on.

Dispose()

Removes the counter from the set that the EventSource will report on.

(Inherited from DiagnosticCounter)
Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string representation of the current event counter instance.

ToString()

Returns a string that represents the current object.

(Inherited from Object)
WriteMetric(Double)

Writes the metric if performance counters are on.

WriteMetric(Single)

Writes the metric if performance counters are on.

Applies to

Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 1.5, 1.6, 2.0, 2.1

See also