Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Performance Counter Programming Architecture

The PerformanceCounter component uses these portions of the Microsoft .NET Framework namespaces:

PerformanceCounter Namespace

Performance Counter Namespace

When you add an instance of the PerformanceCounter component to your application, Visual Studio automatically creates the references and import statements you need to access the namespace and classes. However, if you are creating your PerformanceCounter instances in code, you might need to create a reference to System.dll and add a statement to your project importing (in Visual Basic) or using (in C#) the appropriate namespace (such as System.Diagnostics).

For more information on adding and removing project references, see How to: Add or Remove References in Visual Studio (Visual Basic).

The following are the major classes associated with PerformanceCounter components:

  • System.Diagnostics.PerformanceCounter — the base class used to create PerformanceCounter components and interact with their values.

  • PerformanceCounterCategory — provides access to the categories for which performance counters exist on a server and all of their corresponding properties and methods. You use methods in this class to create new categories and custom counters, to verify that categories and counters exist, and to read the existing counters in a category.

  • 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.

You can use the following methods to interact with performance counters:

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.