From e0a2a3ae0eaaf66056c124d7f6e7db5ca10ff633 Mon Sep 17 00:00:00 2001 From: Sung Yoon Whang Date: Wed, 17 Apr 2019 23:16:47 -0700 Subject: [PATCH] Exposing the new counter APIs in System.Diagnostics.Tracing Commit migrated from https://github.com/dotnet/corefx/commit/c042b3aa7de95332624f3d725e8abdb4d3d043f5 --- .../ref/System.Diagnostics.Tracing.cs | 30 ++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.cs b/src/libraries/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.cs index 173b09a..6263c2c 100644 --- a/src/libraries/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.cs +++ b/src/libraries/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.cs @@ -53,11 +53,37 @@ namespace System.Diagnostics.Tracing public bool DisableEvent(int eventId) { throw null; } public bool EnableEvent(int eventId) { throw null; } } - public partial class EventCounter : System.IDisposable + public abstract partial class DiagnosticCounter : System.IDisposable { - public EventCounter(string name, System.Diagnostics.Tracing.EventSource eventSource) { } + public DiagnosticCounter(string name, EventSource eventSource) { } + public void AddMetadata(string key, string value) { } public void Dispose() { } + public string DisplayName { get { throw null; } set { } } + public string Name { get { throw null; } } + public EventSource EventSource { get { throw null; } } + } + + public partial class EventCounter : System.Diagnostics.Tracing.DiagnosticCounter + { + public EventCounter(string name, System.Diagnostics.Tracing.EventSource eventSource) : base(name, eventSource) { } public void WriteMetric(float value) { } + public void WriteMetric(double value) { } + + } + public partial class PollingCounter : System.Diagnostics.Tracing.DiagnosticCounter + { + public PollingCounter(string name, System.Diagnostics.Tracing.EventSource eventSource, Func metricProvider) : base(name, eventSource) { } + } + public partial class IncrementingEventCounter : System.Diagnostics.Tracing.DiagnosticCounter + { + public IncrementingEventCounter(string name, System.Diagnostics.Tracing.EventSource eventSource) : base(name, eventSource) { } + public void Increment(double increment = 1) { } + public TimeSpan DisplayRateTimeScale { get { throw null; } set { } } + } + public partial class IncrementingPollingCounter : System.Diagnostics.Tracing.DiagnosticCounter + { + public IncrementingPollingCounter(string name, EventSource eventSource, Func totalValueProvider) : base(name, eventSource) { } + public TimeSpan DisplayRateTimeScale { get { throw null; } set { } } } [System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Struct, Inherited=false)] public partial class EventDataAttribute : System.Attribute -- 2.7.4