Add new counters to list (#309)
authorSung Yoon Whang <suwhang@microsoft.com>
Wed, 5 Jun 2019 18:46:03 +0000 (11:46 -0700)
committerGitHub <noreply@github.com>
Wed, 5 Jun 2019 18:46:03 +0000 (11:46 -0700)
* Add new counters to list

* Fix typo / add unit to AllocRate

src/Tools/dotnet-counters/ConsoleWriter.cs
src/Tools/dotnet-counters/CounterMonitor.cs
src/Tools/dotnet-counters/KnownData.cs

index 2ae447641500832d1f522c2b97cf7b67bab7f37b..602cd073da1153995a9c9e7c6fcc983cba8a8d6f 100644 (file)
@@ -17,15 +17,17 @@ namespace Microsoft.Diagnostics.Tools.Counters
         private int maxCol;  // Running maximum of col number
         private int STATUS_ROW; // Row # of where we print the status of dotnet-counters
         private bool paused = false;
+        private bool initialized = false;
         private Dictionary<string, int> knownProvidersRowNum;
         private Dictionary<string, int> unknownProvidersRowNum;
 
         private void UpdateStatus(string msg)
         {
             Console.SetCursorPosition(0, STATUS_ROW);
-            Console.Write(new String(' ', 20));
+            Console.Write(new String(' ', 42)); // Length of the initial string we print on the console..
             Console.SetCursorPosition(0, STATUS_ROW);
             Console.Write(msg);
+            Console.SetCursorPosition(maxRow, maxCol);
         }
 
         public ConsoleWriter()
@@ -72,16 +74,17 @@ namespace Microsoft.Diagnostics.Tools.Counters
 
         public void Update(string providerName, ICounterPayload payload, bool pauseCmdSet)
         {
-            if (paused != pauseCmdSet)
+
+            if (!initialized)
             {
-                ToggleStatus(pauseCmdSet);
+                initialized = true;
+                UpdateStatus("    Status: Running");
             }
 
             if (pauseCmdSet)
             {
                 return;
             }
-
             string name = payload.GetName();
 
             // We already know what this counter is! Just update the value string on the console.
index ff626d9fe38cb3cf5754edb695ba252f70d8dbf8..dc29942c88a06c56662c8d7387e4092637fe8cec 100644 (file)
@@ -39,10 +39,7 @@ namespace Microsoft.Diagnostics.Tools.Counters
         {
             // If we are paused, ignore the event. 
             // There's a potential race here between the two tasks but not a huge deal if we miss by one event.
-            if (pauseCmdSet) 
-            {
-                writer.ToggleStatus(pauseCmdSet);
-            }
+            writer.ToggleStatus(pauseCmdSet);
 
             if (obj.EventName.Equals("EventCounters"))
             {
index e8903b357b6227970089951e4490a2b8c9caa9ee..49c2bd344e5bc72f5ed0e577f4ddba1191bc3c02 100644 (file)
@@ -30,7 +30,18 @@ namespace Microsoft.Diagnostics.Tools.Counters
                     new CounterProfile{ Name="gen-0-gc-count", Description="Number of Gen 0 GCs / sec", DisplayName="Gen 0 GC / sec" },
                     new CounterProfile{ Name="gen-1-gc-count", Description="Number of Gen 1 GCs / sec", DisplayName="Gen 1 GC / sec" },
                     new CounterProfile{ Name="gen-2-gc-count", Description="Number of Gen 2 GCs / sec", DisplayName="Gen 2 GC / sec" },
+                    new CounterProfile{ Name="time-in-gc", Description="% time in GC since the last GC", DisplayName="% Time in GC (since last GC)" },
+                    new CounterProfile{ Name="gen-0-size", Description="Gen 0 Heap Size", DisplayName="Gen 0 Size (B)" },
+                    new CounterProfile{ Name="gen-1-size", Description="Gen 1 Heap Size", DisplayName="Gen 1 Size (B)" },
+                    new CounterProfile{ Name="gen-2-size", Description="Gen 2 Heap Size", DisplayName="Gen 2 Size (B)" },
+                    new CounterProfile{ Name="loh-size", Description="LOH Heap Size", DisplayName="LOH Size (B)" },
+                    new CounterProfile{ Name="alloc-rate", Description="Allocation Rate", DisplayName="Allocation Rate (Bytes / sec)" },
+                    new CounterProfile{ Name="assembly-count", Description="Number of Assemblies Loaded", DisplayName="# of Assemblies Loaded" },
                     new CounterProfile{ Name="exception-count", Description="Number of Exceptions / sec", DisplayName="Exceptions / sec" },
+                    new CounterProfile{ Name="threadpool-thread-count", Description="Number of ThreadPool Threads", DisplayName="ThreadPool Threads Count" },
+                    new CounterProfile{ Name="monitor-lock-contention-count", Description="Monitor Lock Contention Count", DisplayName="Monitor Lock Contention Count / sec" },
+                    new CounterProfile{ Name="threadpool-queue-length", Description="ThreadPool Work Items Queue Length", DisplayName="ThreadPool Queue Length" },
+                    new CounterProfile{ Name="threadpool-completed-items-count", Description="ThreadPool Completed Work Items Count", DisplayName="ThreadPool Completed Work Items / sec" },
                 });
             // TODO: Add more providers (ex. ASP.NET ones)
         }