Fix description list command (#974)
authorSung Yoon Whang <suwhang@microsoft.com>
Thu, 2 Apr 2020 03:30:28 +0000 (20:30 -0700)
committerGitHub <noreply@github.com>
Thu, 2 Apr 2020 03:30:28 +0000 (20:30 -0700)
* cleanup unused field, fix description of GC collection counts in list command

* Fix build

src/Tools/dotnet-counters/CounterProvider.cs
src/Tools/dotnet-counters/Exporters/ConsoleWriter.cs
src/Tools/dotnet-counters/KnownData.cs

index 07400071b3c5689f7cf772337f40b7a0d2a1c617..5bcdf2edef5e317c6b1c65a5d108be999b8b29b8 100644 (file)
@@ -29,13 +29,6 @@ namespace Microsoft.Diagnostics.Tools.Counters
             }
         }
 
-        public string TryGetDisplayName(string counterName)
-        {
-            if (Counters.ContainsKey(counterName))
-                return Counters[counterName].DisplayName;
-            return null;
-        }
-
         public string ToProviderString(int interval)
         {
             return $"{Name}:{Keywords}:{Level}:EventCounterIntervalSec={interval}";
@@ -53,7 +46,6 @@ namespace Microsoft.Diagnostics.Tools.Counters
     public class CounterProfile
     {
         public string Name { get; set; }
-        public string DisplayName { get; set; }
         public string Description { get; set; }
     }
 }
index 29720b64ee9d61eae88a9bd408cc797dca336d8a..a17d9c3c628b0e092654f79a65bedc43908e8ae1 100644 (file)
@@ -118,7 +118,7 @@ namespace Microsoft.Diagnostics.Tools.Counters.Exporters
 
             if (!provider.Counters.TryGetValue(name, out ObservedCounter counter))
             {
-                string displayName = provider.KnownProvider?.TryGetDisplayName(name) ?? (string.IsNullOrWhiteSpace(payload.GetDisplay()) ? name : payload.GetDisplay());
+                string displayName = payload.GetDisplay();
                 provider.Counters[name] = counter = new ObservedCounter(displayName);
                 maxNameLength = Math.Max(maxNameLength, displayName.Length);
                 redraw = true;
index b9f5f08c55365e25a2de4596775785e32ba70551..b27f54bec1ac46c5cd9a72c778437d9fe0862994 100644 (file)
@@ -23,25 +23,25 @@ namespace Microsoft.Diagnostics.Tools.Counters
                 "0xffffffff", // Keywords
                 "5", // Level 
                 new[] { // Counters
-                    new CounterProfile{ Name="cpu-usage", Description="Amount of time the process has utilized the CPU (ms)", DisplayName="CPU Usage (%)" },
-                    new CounterProfile{ Name="working-set", Description="Amount of working set used by the process (MB)", DisplayName="Working Set (MB)" },
-                    new CounterProfile{ Name="gc-heap-size", Description="Total heap size reported by the GC (MB)", DisplayName="GC Heap Size (MB)" },
-                    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" },
-                    new CounterProfile{ Name="active-timer-count", Description="Active Timers Count", DisplayName="Number of Active Timers" },
+                    new CounterProfile{ Name="cpu-usage", Description="Amount of time the process has utilized the CPU (ms)" },
+                    new CounterProfile{ Name="working-set", Description="Amount of working set used by the process (MB)" },
+                    new CounterProfile{ Name="gc-heap-size", Description="Total heap size reported by the GC (MB)" },
+                    new CounterProfile{ Name="gen-0-gc-count", Description="Number of Gen 0 GCs / min" },
+                    new CounterProfile{ Name="gen-1-gc-count", Description="Number of Gen 1 GCs / min" },
+                    new CounterProfile{ Name="gen-2-gc-count", Description="Number of Gen 2 GCs / min" },
+                    new CounterProfile{ Name="time-in-gc", Description="% time in GC since the last GC" },
+                    new CounterProfile{ Name="gen-0-size", Description="Gen 0 Heap Size" },
+                    new CounterProfile{ Name="gen-1-size", Description="Gen 1 Heap Size" },
+                    new CounterProfile{ Name="gen-2-size", Description="Gen 2 Heap Size" },
+                    new CounterProfile{ Name="loh-size", Description="LOH Heap Size" },
+                    new CounterProfile{ Name="alloc-rate", Description="Allocation Rate" },
+                    new CounterProfile{ Name="assembly-count", Description="Number of Assemblies Loaded" },
+                    new CounterProfile{ Name="exception-count", Description="Number of Exceptions / sec" },
+                    new CounterProfile{ Name="threadpool-thread-count", Description="Number of ThreadPool Threads" },
+                    new CounterProfile{ Name="monitor-lock-contention-count", Description="Monitor Lock Contention Count" },
+                    new CounterProfile{ Name="threadpool-queue-length", Description="ThreadPool Work Items Queue Length" },
+                    new CounterProfile{ Name="threadpool-completed-items-count", Description="ThreadPool Completed Work Items Count" },
+                    new CounterProfile{ Name="active-timer-count", Description="Active Timers Count" },
                 });
             yield return new CounterProvider(
                 "Microsoft.AspNetCore.Hosting", // Name
@@ -49,10 +49,10 @@ namespace Microsoft.Diagnostics.Tools.Counters
                 "0x0", // Keywords
                 "4", // Level 
                 new[] { // Counters
-                    new CounterProfile{ Name="requests-per-second", Description="Request rate", DisplayName="Request / sec" },
-                    new CounterProfile{ Name="total-requests", Description="Total number of requests", DisplayName="Total Requests" },
-                    new CounterProfile{ Name="current-requests", Description="Current number of requests", DisplayName="Current Requests" },
-                    new CounterProfile{ Name="failed-requests", Description="Failed number of requests", DisplayName="Failed Requests" },
+                    new CounterProfile{ Name="requests-per-second", Description="Request rate" },
+                    new CounterProfile{ Name="total-requests", Description="Total number of requests" },
+                    new CounterProfile{ Name="current-requests", Description="Current number of requests" },
+                    new CounterProfile{ Name="failed-requests", Description="Failed number of requests" },
                 });
         }