Werner
Werner

Reputation: 1311

Why are my Performance Counter values reset when application terminates?

I have a web service that creates it's own single instance performance counters. When the pool shuts down (or recycled/restarted IIS) and perfmon is restarted, my int64 counters are all back to 0. Is there a way to create the category and/or counters so that they "survive" application shutdown?

Upvotes: 5

Views: 2159

Answers (1)

Richard
Richard

Reputation: 109090

Is there a way to create the category and/or counters so that they "survive" application shutdown?

Yes, but only by implementing performance counters from scratch using the Win32 APIs, and for the component that PerfMon (or remoting of perf mon) uses to read the values for display this should be completely native code.

In practice it will be easier to provide your own persistence of values and set the initial values of the counters on start up (and this could then persist across things like machine restarts if desired).

Upvotes: 4

Related Questions