Adding Counters to Your Service

When you create counters, you have to decide exactly what information you want to expose. Because performance counters are merely numeric representations of internal metrics, you should expose whatever you think is important for an end user to know.

Creating Your Counters

After you define the information that you want to expose, you need to use that information to create a counter category and the appropriate counter objects you want to expose to the consumers.

In Perfmon, the category represents the Performance Object, which is the master object for all the exposed counters that exist within that category. Let’s take a look at the system-exposed Processor category.

The category is called Processor. On the left are ...

Get Programming Windows® Services with Microsoft® Visual Basic® 2008 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.