Add active timer counter (#25186)
authorSung Yoon Whang <suwhang@microsoft.com>
Sat, 15 Jun 2019 23:46:02 +0000 (16:46 -0700)
committerGitHub <noreply@github.com>
Sat, 15 Jun 2019 23:46:02 +0000 (16:46 -0700)
* Add active timer counter

* fix typo

src/System.Private.CoreLib/src/System/Diagnostics/Eventing/RuntimeEventSource.cs

index 2011101..1e75d0e 100644 (file)
@@ -31,6 +31,7 @@ namespace System.Diagnostics.Tracing
         private PollingCounter? _lohSizeCounter;
         private IncrementingPollingCounter? _allocRateCounter;
         private PollingCounter? _assemblyCounter;
+        private PollingCounter? _timerCounter;
 
         private const int EnabledPollingIntervalMilliseconds = 1000; // 1 second
 
@@ -70,6 +71,7 @@ namespace System.Diagnostics.Tracing
                 _lohSizeCounter = _lohSizeCounter ?? new PollingCounter("loh-size", this, () => GC.GetGenerationSize(3)) { DisplayName = "LOH Size" };
                 _allocRateCounter = _allocRateCounter ?? new IncrementingPollingCounter("alloc-rate", this, () => GC.GetTotalAllocatedBytes()) { DisplayName = "Allocation Rate", DisplayRateTimeScale = new TimeSpan(0, 0, 1) };
                 _assemblyCounter = _assemblyCounter ?? new PollingCounter("assembly-count", this, () => System.Reflection.Assembly.GetAssemblyCount()) { DisplayName = "Number of Assemblies Loaded" };
+                _timerCounter = _timerCounter ?? new PollingCounter("active-timer-count", this, () => Timer.ActiveCount) { DisplayName = "Number of Active Timers" };
             }
         }
     }