Export (0) Print
Expand All

Category and Counter Management

You create categories and custom performance counters if you want to track data that is not captured by the standard counters provided with Microsoft Windows. For example, you might create a custom counter to track the total number of users logged on to your Web site, or to track the orders processed per second by your site. When you create a counter, you add it to a performance counter category, and you assign it a type that governs how it will behave. For information about choosing the correct type, see Performance Counter Types.

There are several ways you can create custom counters:

You must create counters in a user-defined category instead of in the performance objects (called categories in Visual Studio and the .NET Framework) defined by Windows. That is, you cannot create a new counter in the Processor category or any other system-defined categories. Additionally, you must create a counter in a new category; adding a counter to an existing user-defined category will raise an exception.

The following restrictions apply to the process of creating new counters:

  • You can create custom counters on the local computer, provided that you have administrator access.

    NoteNote:

    To access performance counters, you must be a member of the security group that has access to performance counters (for example, the Performance Monitor Users group). Additionally, you might receive prompts on Windows Vista when you try to perform an action that requires elevated privileges, even when you are running under administrative permissions. For more information, see Windows Vista and Visual Studio.

  • If you do not specify a counter type when you create the counter and its category, the default counter type is NumberofItems32.

  • You cannot create new counters within existing categories. If you have to add counters to categories that already exist, the only way you can do so is to delete the category and re-create it with all of its contents. This includes the new counters you want to add.

  • There are security restrictions that affect your ability to create counters and categories. For more information, see Introduction to Monitoring Performance Thresholds.

  • The PerformanceCounter class is not fully supported on Microsoft Windows NT version 4.0. You can read from the system counters, but you cannot create, write to, or delete custom counters.

Community Additions

ADD
Show:
© 2014 Microsoft