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()
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.
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)
}