Accessing Built-in Performance Counters
The performance counter framework provides access to existing operating system counters. The help files associated with the operating system performance monitor application have more information on what counters are available.
Using a performance counter involves declaring a PerformanceCounter object, initializing its properties as desired and requesting the counter value at various intervals to watch performance. The program in Listings 32.1 and 32.2 comprise a fictitious ordering system that demonstrates the use of system performance counters. The program is sufficiently equipped to degrade system performance, where the effects can be observed by watching the performance counter.
Listing 32.1. System ...
Get C# Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.