This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!
Performance Counter Programming Architecture
The PerformanceCounter component uses these portions of the NGWS frameworks namespaces:
PerformanceCounter Namespace

If you are creating your PerformanceCounter components in code, you may need to add a reference to System.Diagnostics to your build command
Key Performance Counter Classes
The following are the major classes associated with PerformanceCounter components:
- System.Diagnostics.PerformanceCounter — the base class used to create PerformanceCounter components, new counter categories, and custom counters.
- System.Diagnostics.PerformanceCounterCategory — provides access to the categories for which performance counters exist on a server and all of their corresponding properties and methods.
- System.Diagnostics.CounterCreationData — used to create multiple counters for a category; allows you to explicitly choose the counter type for each counter you create.
- System.Diagnostics.InstanceData — used to retrieve multiple instances of a counter and all of their corresponding properties and methods.
Key Programming Elements in the PerformanceCounter Base Class
You can use the following methods to interact with an instance of the PerformanceCounter component:
- Use the CreateCategory method to create a new counter by defining a category containing one or more counters. Similarly, the DeleteCategory method removes a user-defined category and the counters it contains.
- Use the ReadCategory method to read all of the counters in a category.
- Use the CategoryExists method to determine if a category of counters already exists.
- Use the IncrementBy method to increment a counter value by the specified integer and to return the new value of the counter.
- Use the NextValue method to return the next raw value for the sample, or the NextSample method to return the next sampling.
- Use the GetCounters method to return an array of counters in a category.
See Also
Adding and Removing References | Introduction to Monitoring Performance Thresholds