TECHNOLOGIES: NT Performance Counters
A Cool Performance Stats Tool
By Jeff Prosise
Did you know the .NET Framework, and ASP.NET in particular, exposes a variety of performance statistics through NT performance counters? To get an idea of the types of information exposed, pull up the Windows Perfmon utility and check out the "ASP.NET" and "ASP.NET Applications" categories. Managed code can access these counters programmatically using the System.Diagnostics.PerformanceCounter class. This article's downloadable sample code, which I named PerfMon.aspx, uses several ASP.NET performance counters to display a live snapshot of ASP.NET activity. The page refreshes automatically every five seconds, keeping the statistics up to date without user intervention. Feel free to modify the code to add additional statistics or change the format of the output.
The sample code in this article is available for download.
Jeff Prosise is author of several books, including Programming Microsoft .NET (Microsoft Press). He also is a co-founder of Wintellect (http://www.wintellect.com), a software consulting and education firm that specializes in .NET. Got a question for this column? Submit queries to [email protected].