C# Custom Performance Counters - First Performance Counter
Table of content: I. C# Custom Performance Counters - Introduction II. C# Custom Performance Counters - First Performance Counter 1. Creating a custom Performance Counters and Performance counters category. You can create your own Performance category and Performance counters. To achieve this goal you can use Visual Studio tools, or .NET System.Diagnostics objects. In this post I’ll describe counters and category creation in a code using using System.Diagnostics; First of all you need to make a counters collection: CounterCreationDataCollection collection = new CounterCreationDataCollection(); Then you need to create performance counter CounterCreationData counter = new CounterCreationData(); counter.CounterName = "CountsPerSecond"; counter.CounterHelp = "CountsPerSecond"; counter.CounterType = PerformanceCounterType.RateOfCountsPerSecond32); collection.Add(counter); And place it into the category. As the category type you can use SingleInstance and M...