Exposing the new counter APIs in System.Diagnostics.Tracing
authorSung Yoon Whang <suwhang@microsoft.com>
Thu, 18 Apr 2019 06:16:47 +0000 (23:16 -0700)
committerSung Yoon Whang <suwhang@microsoft.com>
Fri, 19 Apr 2019 02:27:39 +0000 (19:27 -0700)
Commit migrated from https://github.com/dotnet/corefx/commit/c042b3aa7de95332624f3d725e8abdb4d3d043f5

src/libraries/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.cs

index 173b09a..6263c2c 100644 (file)
@@ -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<double> 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<double> 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