Building a Customized Performance Counter

Often the system performance counters are enough for monitoring a system's performance. However, sometimes you need a specialized counter that gives a unique picture of what's happening in a specific program. Making customized performance counters is possible, due to the extensible nature of the performance counter framework.

Implementing a customized performance counter requires creating a new counter type and a new category to hold the new counter. The performance counter will be instantiated with the new counter and category definitions. Additional logic is also necessary to load the custom performance counter with program specific data. Listings 32.3 and 32.4 show how to implement custom performance ...

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.