This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!
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.
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, the reference to the counters is maintained and counter values continue to accumulate.
- You can install and run the Windows service PerformanceCounterService.exe. As long as the service is running, counter values continue to accumulate without being reset to zero, unless you manually reset the value. For instructions on setting up the service, see Setting Up the Performance Counter Service.
- 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
Setting Up the Performance Counter Service | Introduction to Monitoring Performance Thresholds