summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSung Yoon Whang <suwhang@microsoft.com>2019-04-04 10:38:14 -0700
committerGitHub <noreply@github.com>2019-04-04 10:38:14 -0700
commit5f5bd45f855387808672ba0d270863962e625445 (patch)
tree0cc95b3858d5a8e7e29f906352577a022eaad769 /src
parent358d9d2559bd57cee7b2d4d0bc6d03ea252f4da8 (diff)
downloadcoreclr-5f5bd45f855387808672ba0d270863962e625445.tar.gz
coreclr-5f5bd45f855387808672ba0d270863962e625445.tar.bz2
coreclr-5f5bd45f855387808672ba0d270863962e625445.zip
Add Working Set runtime counter (#23717)
* Add cpu counter * Fix windows build * Make the counter just return current CPU usage as % * Add Unix * Fix unix build * Some cleanup * rename * fixing some build errors * some cleanup * remove unused using * more cleanup * newline * Add working set counter * Remove old file
Diffstat (limited to 'src')
-rw-r--r--src/System.Private.CoreLib/src/System/Diagnostics/Eventing/RuntimeEventSource.cs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/RuntimeEventSource.cs b/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/RuntimeEventSource.cs
index 31effe3137..d264910086 100644
--- a/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/RuntimeEventSource.cs
+++ b/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/RuntimeEventSource.cs
@@ -21,6 +21,7 @@ namespace System.Diagnostics.Tracing
private IncrementingPollingCounter _gen2GCCounter;
private IncrementingPollingCounter _exceptionCounter;
private PollingCounter _cpuTimeCounter;
+ private PollingCounter _workingSetCounter;
private const int EnabledPollingIntervalMilliseconds = 1000; // 1 second
@@ -43,6 +44,7 @@ namespace System.Diagnostics.Tracing
// On disable, PollingCounters will stop polling for values so it should be fine to leave them around.
_cpuTimeCounter = _cpuTimeCounter ?? new PollingCounter("CPU Usage", this, () => RuntimeEventSourceHelper.GetCpuUsage());
+ _workingSetCounter = _workingSetCounter ?? new PollingCounter("Working Set", this, () => Environment.WorkingSet);
_gcHeapSizeCounter = _gcHeapSizeCounter ?? new PollingCounter("GC Heap Size", this, () => GC.GetTotalMemory(false));
_gen0GCCounter = _gen0GCCounter ?? new IncrementingPollingCounter("Gen 0 GC Count", this, () => GC.CollectionCount(0));
_gen1GCCounter = _gen1GCCounter ?? new IncrementingPollingCounter("Gen 1 GC Count", this, () => GC.CollectionCount(1));