Performance counters have a type definition that determines how they interact with monitoring applications and the counter values they contain. For example, suppose you are creating an instance of the PerformanceCounter component to count the number of orders processed per second in your e-commerce application. You create a performance counter that increments by one after processing each order. In this case, you would set the CounterType to RateOfChangePerSecond32. This type tells the counter to calculate the number of orders processed per second by taking two samplings and dividing by the timing of the samples. The more samplings taken, the more relevant the data becomes.
There are many types of performance counters you can choose from when you create a counter. Some of the counters have specific calculations associated with them, and some contain uncalculated values only. In general, there are a few counter types that you will use most frequently. The following table lists these types by common usage patterns.
If You Need To | Use This Type of Counter | Example |
---|---|---|
Maintain a simple count of items, operations, and so on. | NumberofItems32 | You might use this counter type to track the number of orders received. |
Maintain a simple count with a higher capacity | NumberofItems64 | You might use this counter type to track orders for a site that experiences very high volume. |
Track the amount per second of an item or operation | CountPerTimeInterval32 | You might use this counter type to track the orders received per second on a retail site. |
Track the amount per second with a higher capacity | CountPerTimeInterval64 | You might use this counter type to track the orders per second for a site that experiences very high volume. |
Calculate average time to perform a process or to process an item | AverageTimePerSecond32 | You might use this counter type to calculate the average time an order takes to be processed. |
Calculate average time to perform a process with a higher capacity | AverageTimePerSecond64 | You might use this counter type to calculate the average time an order takes to be processed on a system with very high volume. |
A few caveats on counter type:
For a full list of the types available, see CounterTypeEnum.
Introduction to Monitoring Performance Thresholds | Creating Custom Performance Counters | Creating Performance Counter Categories