Bagikan melalui


Performance Counter Types

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 RateOfCountsPerSecond32. 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.

Choosing the Right Counter Type

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 as a 32-bit number.

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; stored as a 64-bit number.

Track the amount per second of an item or operation

RateOfCountsPerSecond32

You might use this counter type to track the orders received per second on a retail site; stored as a 32-bit number.

Track the amount per second with a higher capacity

RateOfCountsPerSecond64

You might use this counter type to track the orders per second for a site that experiences very high volume; stored as a 64-bit number.

Calculate average time to perform a process or to process an item

AverageTimer32

You might use this counter type to calculate the average time an order takes to be processed; stored as a 32-bit number.

A few caveats on counter type:

For a full list of the types available, see PerformanceCounterType.

See Also

Tasks

How to: Create Custom Performance Counters

How to: Create Performance Counter Categories

Concepts

Introduction to Monitoring Performance Thresholds