C# – How To Retrieve “AverageValue” Performance Counter

cnet

I am trying to retrieve windows performance counter and display it in ASP.NET page.
However, I am having dificulty to retrieve the average type of counter.

Say, I want to retrieve counter like how many page request per second? I have no idea to calculate that value, since the PerformanceCounter class only give me RawValue and NextValue which always zero.

Please advice..

Thanks..

Best Answer

One way to run average page requests per second is some form of web log analyzer. Some may even have average functions built in.

If this is not an acceptable answer, you might want to get the counters you desire and store the polling values they give you back. If this is merely average page requests/second, you can add each hit with a time value and keep it lighter weight, as having to run the perfmon the entire time might not be the best answer.

If I were google searching, I would look at instrumentation, as that is what you are aiming at doing here. Good luck on your quest.