Partilhar via


Performance Counter Lifetime 

It is important to understand that performance counter values are values rather than entries — when you write a value to a performance counter, you are not making a permanent entry in the counter as you do when you write an entry to an event log. Rather, performance counter values are transitory. When the last PerformanceCounter component to reference a particular system counter is disposed of, the counter resets itself to zero.

Managing the Lifetime

There are several ways you can manage the lifetime of a performance counter if you want to retain values for a longer period of time than the default counter behavior allows:

  • You can run the Performance Monitor application on the server where the counter lives. As long as Performance Monitor is open and actively monitoring the category for your counter, the reference to the counter is maintained and counter values continue to accumulate.

  • You can make sure that there is always an instance of the PerformanceCounter component connected to the particular counter for which you want to maintain values.

See Also

Concepts

Introduction to Monitoring Performance Thresholds
Performance Counter Types