Creating Your Own Performance Counters

The performance counters provided to you by the operating system are often useful for a variety of tasks. However, what if you want to provide counters from your application, such as the average orders per second entered into a database? In the past, you would have simply coded some variables into the application and tracked them yourself, perhaps writing them to a file or database. Now, however, the PerformanceCounter class allows you to create your own counters on the fly, and these counters can be exposed through the Performance Monitor application.

There are two ways to create custom counters and categories: You can use the Performance Counter Builder or you can create the categories and counters in ...

Get A Programmer's Introduction to Visual Basic® .NET 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.