System [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00] 1.0.3300.0 1.0.5000.0 2.0.0.0 4.0.0.0 Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details. System.ComponentModel.Component System.ComponentModel.ISupportInitialize System.ComponentModel.InstallerType(typeof(System.Diagnostics.PerformanceCounterInstaller))

The component can be used for both reading existing predefined or custom counters and publishing (writing) performance data to custom counters.

In versions 1.0 and 1.1 of the .NET Framework, this class requires immediate callers to be fully trusted. Starting with the .NET Framework version 2.0, this class requires for specific actions. It is strongly recommended that not be granted to semi-trusted code. The ability to read and write performance counters allows code to perform actions such as enumerating executing processes and obtaining information about them.

Passing a object to less-trusted code can create a security issue. Never pass performance counter objects, such as a or , to less trusted code.

The predefined counters are too numerous to mention. You can get a list of the available pre-existing counters from the Windows Performance Monitor's Add Counters dialog box. To learn about the .NET Framework performance counters, see Performance Counters in the .NET Framework.

To read from a performance counter, create an instance of the class, set the , , and, optionally, the or properties, and then call the method to take a performance counter reading.

To publish performance counter data, create one or more custom counters using the method, create an instance of the class, set the , and, optionally, or properties, and then call the , , or methods, or set the property to change the value of your custom counter.

The , , and methods use interlocks to update the counter value. This helps keep the counter value accurate in multithreaded or multiprocess scenarios, but also results in a performance penalty. If you do not need the accuracy that interlocked operations provide, you can update the property directly for up to a 5 times performance improvement. However, in multithreaded scenarios, some updates to the counter value might be ignored, resulting in inaccurate data.

The counter is the mechanism by which performance data is collected. The registry stores the names of all the counters, each of which is related to a specific area of system functionality. Examples include a processor's busy time, memory usage, or the number of bytes received over a network connection.

Each counter is uniquely identified through its name and its location. In the same way that a file path includes a drive, a directory, one or more subdirectories, and a file name, counter information consists of four elements: the computer, the category, the category instance, and the counter name.

The counter information must include the category, or performance object, that the counter measures data for. A computer's categories include physical components, such as processors, disks, and memory. There are also system categories, such as processes and threads. Each category is related to a functional element within the computer and has a set of standard counters assigned to it. These objects are listed in the Performance object drop-down list of the Add Counters dialog box within the Windows 2000 System Monitor, and you must include them in the counter path. Performance data is grouped by the category to which is it related.

In certain cases, several copies of the same category can exist. For example, several processes and threads run simultaneously, and some computers contain more than one processor. The category copies are called category instances, and each instance has a set of standard counters assigned to it. If a category can have more than one instance, an instance specification must be included in the counter information.

To obtain performance data for counters that required an initial or previous value for performing the necessary calculation, call the method twice and use the information returned as your application requires.

Performance counter categories installed with the dnprdnlong use separate shared memory, with each performance counter category having its own memory. You can specify the size of separate shared memory by creating a DWORD named FileMappingSize in the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<category name>\Performance. The FileMappingSize value is set to the shared memory size of the category. The default size is 131072 decimal. If the FileMappingSize value is not present, the fileMappingSize attribute value for the performanceCounters element specified in the Machine.config file is used, causing additional overhead for configuration file processing. You can realize a performance improvement for application startup by setting the file mapping size in the registry. For more information about the file mapping size, see <performanceCounters> Element.

Represents a Windows NT performance counter component.

- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0

  This overload of the constructor sets the , , and properties to empty strings (""), and sets the property to the local computer, (".").

  This constructor does not initialize the performance counter, so it does not associate the instance with an existing counter on the local computer. To point to a specific performance counter, set the , , and, optionally, the and properties before reading any other properties or attempting to read from a counter. To write to a performance counter, set the property to false.

  The attribute applied to this member has the following property value: | . The does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the class or SQL Server Programming and Host Protection Attributes.

  Initializes a new, read-only instance of the class, without associating the instance with any system or custom performance counter.

- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0

  The parameter strings are not case-sensitive.

  Use this overload to access a counter on the local computer that belongs to a category containing a single performance counter category instance. If you attempt to use this constructor to point this instance to a category that contains multiple instances, the constructor throws an exception. This overload can access any read-only or read/write counter, but does so in a read-only mode. A instance created using this overload cannot write to the counter, even if the counter itself is read/write.

  This overload of the constructor sets the and properties to the values you pass in, sets the property to the local computer, ".", and sets the property to an empty string ("").

  This constructor initializes the performance counter and associates the instance with an existing counter (either a system or a custom counter) on the local computer. The values that you pass in for the and properties must point to an existing performance counter on the local computer.

  To read performance counters in Windows Vista, Windows XP Professional x64 Edition, or Windows Server 2003, you must either be a member of the Performance Monitor Users group or have administrative privileges.

  To avoid having to elevate your privileges to access performance counters in Windows Vista, add yourself to the Performance Monitor Users group.

  In Windows Vista, User Account Control (UAC) determines the privileges of a user. If you are a member of the Built-in Administrators group, you are assigned two run-time access tokens: a standard user access token and an administrator access token. By default, you are in the standard user role. To execute the code that accesses performance counters, you must first elevate your privileges from standard user to administrator. You can do this when you start an application by right-clicking the application icon and indicating that you want to run as an administrator.

  Initializes a new, read-only instance of the class and associates it with the specified system or custom performance counter on the local computer. This constructor requires that the category have a single instance.

  The name of the performance counter category (performance object) with which this performance counter is associated.
  The name of the performance counter.
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0

  The parameter strings are not case-sensitive.

  Use this overload to access a read-only or read/write counter on the local computer that belongs to a category containing a single performance counter category instance. If you attempt to use this constructor to point this instance to a category that contains multiple instances, the constructor throws an exception.

  This overload of the constructor sets the , , and properties to the values you pass in, sets the property to the local computer, ".", and sets the property to an empty string ("").

  This constructor initializes the performance counter and associates the instance with an existing counter (either a system or a custom counter) on the local computer. The values that you pass in for the and properties must point to an existing performance counter on the local computer. If the performance counter instance that you point to is not valid, calling the constructor throws an exception.

  You can use this overload to connect to a system counter, but you cannot write to a system counter. Therefore, setting to false when connecting to a system counter causes the constructor to throw an exception.

  To read performance counters in Windows Vista, Windows XP Professional x64 Edition, or Windows Server 2003, you must either be a member of the Performance Monitor Users group or have administrative privileges.

  To avoid having to elevate your privileges to access performance counters in Windows Vista, add yourself to the Performance Monitor Users group.

  In Windows Vista, User Account Control (UAC) determines the privileges of a user. If you are a member of the Built-in Administrators group, you are assigned two run-time access tokens: a standard user access token and an administrator access token. By default, you are in the standard user role. To execute the code that accesses performance counters, you must first elevate your privileges from standard user to administrator. You can do this when you start an application by right-clicking the application icon and indicating that you want to run as an administrator.

  Initializes a new, read-only or read/write instance of the class and associates it with the specified system or custom performance counter on the local computer. This constructor requires that the category contain a single instance.

  The name of the performance counter category (performance object) with which this performance counter is associated.
  The name of the performance counter.
  true to access the counter in read-only mode (although the counter itself could be read/write); false to access the counter in read/write mode.
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0

  The parameter strings are not case-sensitive.

  This overload of the constructor sets the , , and properties to the values you pass in, and sets the property to the local computer, ".".

  This constructor initializes the performance counter and associates the instance with an existing counter (either a system or a custom counter) on the local computer. The values that you pass in for the , , and properties must point to an existing performance counter on the local computer. If the performance counter instance you point to is not valid, calling the constructor throws an exception.

  This overload can access any read-only or read/write counter, but does so in a read-only mode. A instance created using this overload cannot write to the counter, even if the counter itself is read/write.

  To create a performance category instance, specify an on the constructor. If the category instance specified by already exists the new object will reference the existing category instance.

  To read performance counters in Windows Vista, Windows XP Professional x64 Edition, or Windows Server 2003, you must either be a member of the Performance Monitor Users group or have administrative privileges.

  To avoid having to elevate your privileges to access performance counters in Windows Vista, add yourself to the Performance Monitor Users group.

  In Windows Vista, User Account Control (UAC) determines the privileges of a user. If you are a member of the Built-in Administrators group, you are assigned two run-time access tokens: a standard user access token and an administrator access token. By default, you are in the standard user role. To execute the code that accesses performance counters, you must first elevate your privileges from standard user to administrator. You can do this when you start an application by right-clicking the application icon and indicating that you want to run as an administrator.

  Initializes a new, read-only instance of the class and associates it with the specified system or custom performance counter and category instance on the local computer.

  The name of the performance counter category (performance object) with which this performance counter is associated.
  The name of the performance counter.
  The name of the performance counter category instance, or an empty string (""), if the category contains a single instance.
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0

  The parameter strings are not case-sensitive.

  Use this overload to access a performance counter in either read-only or read/write mode.

  This overload of the constructor sets the , , and properties to the values you pass in, it and sets the property to the local computer, ".".

  This constructor initializes the performance counter and associates the instance with an existing counter (either a system or a custom counter) on the local computer. The values that you pass in for the , , and properties must point to an existing performance counter on the local computer. If the performance counter instance that you point to is not valid, calling the constructor throws an exception.

  You can use this overload to connect to a system counter, but you cannot write to a system counter. Therefore, setting to false when connecting to a system counter causes the constructor to throw an exception.

  To create a performance category instance, specify an on the constructor. If the category instance specified by already exists the new object will reference the existing category instance.

  To read performance counters in Windows Vista, Windows XP Professional x64 Edition, or Windows Server 2003, you must either be a member of the Performance Monitor Users group or have administrative privileges.

  To avoid having to elevate your privileges to access performance counters in Windows Vista, add yourself to the Performance Monitor Users group.

  In Windows Vista, User Account Control (UAC) determines the privileges of a user. If you are a member of the Built-in Administrators group, you are assigned two run-time access tokens: a standard user access token and an administrator access token. By default, you are in the standard user role. To execute the code that accesses performance counters, you must first elevate your privileges from standard user to administrator. You can do this when you start an application by right-clicking the application icon and indicating that you want to run as an administrator.

  Initializes a new, read-only or read/write instance of the class and associates it with the specified system or custom performance counter and category instance on the local computer.

  The name of the performance counter category (performance object) with which this performance counter is associated.
  The name of the performance counter.
  The name of the performance counter category instance, or an empty string (""), if the category contains a single instance.
  true to access a counter in read-only mode; false to access a counter in read/write mode.
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0

  The parameter strings are not case-sensitive.

  This overload of the constructor sets the , , , and properties to the values you pass in.

  This constructor initializes the performance counter and associates the instance with an existing counter (either a system or a custom counter) on the specified computer. The values that you pass in for the , , and properties must point to an existing performance counter. If the performance counter instance you point to is not valid, calling the constructor throws an exception. This overload can access any read-only or read/write counter, but does so in a read-only mode. A instance created using this overload cannot write to the counter, even if the counter itself is read/write.

  You cannot write to remote performance counters. There is no overload that allows you to specify a read/write instance of the class that connects to a remote computer.

  To create a performance category instance, specify an on the constructor. If the category instance specified by already exists the new object will reference the existing category instance.

  To read performance counters in Windows Vista, Windows XP Professional x64 Edition, or Windows Server 2003, you must either be a member of the Performance Monitor Users group or have administrative privileges.

  To avoid having to elevate your privileges to access performance counters in Windows Vista, add yourself to the Performance Monitor Users group.

  In Windows Vista, User Account Control (UAC) determines the privileges of a user. If you are a member of the Built-in Administrators group, you are assigned two run-time access tokens: a standard user access token and an administrator access token. By default, you are in the standard user role. To execute the code that accesses performance counters, you must first elevate your privileges from standard user to administrator. You can do this when you start an application by right-clicking the application icon and indicating that you want to run as an administrator.

  In Windows Vista, when the remote computer is a member of a workgroup, you may need to disable UAC so that the local user account is not filtered and can be elevated to an administrator account. For security reasons, disabling UAC should be a last resort. For information on disabling UAC, see User Account Control and WMI.

  Initializes a new, read-only instance of the class and associates it with the specified system or custom performance counter and category instance, on the specified computer.

  The name of the performance counter category (performance object) with which this performance counter is associated.
  The name of the performance counter.
  The name of the performance counter category instance, or an empty string (""), if the category contains a single instance.
  The computer on which the performance counter and its associated category exist.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void

  The vsprvslong design environment uses this method to start the initialization of a component that is used on a form or by another component. The method ends the initialization. Using the and methods prevents the component from being used before it is fully initialized.

  Begins the initialization of a instance used on a form or by another component. The initialization occurs at runtime.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DefaultValue("")
  System.ComponentModel.ReadOnly(true)
  System.ComponentModel.RecommendedAsConfigurable(true)
  System.ComponentModel.TypeConverter("System.Diagnostics.Design.CategoryValueConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
  System.String To be added: an object of type 'string'

  The is displayed in the Performance Object field of Performance Counter Manager MMC snap in's Add Counter dialog box.

  A performance counter monitors the behavior of a category, or performance object, on a computer. Categories include physical components (such as processors, disks, and memory) and system objects (such as processes and threads). System counters that are related to the same performance object are grouped into a category that indicates their common focus. When you create an instance of the class, you first indicate the category with which the component will interact, and then you choose a counter from that category.

  For example, one Windows counter category is the Memory category. System counters within this category track memory data such as the number of bytes available and the number of bytes cached. If you wanted to work with the bytes cached in your application, you would create an instance of the component, connect it to the Memory category, and then pick the appropriate counter (in this case, Cached Bytes) from that category.

  Although your system makes many more counter categories available, the categories that you will probably interact with most frequently are the Cache, Memory, Objects, PhysicalDisk, Process, Processor, Server, System, and Thread categories.

  Gets or sets the name of the performance counter category for this performance counter.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void

  When you associate this instance with a performance counter that resides on the server, the system initializes the instance and allocates memory to contain counter sample information. The method frees the resources allocated by the object.

  Closes the performance counter and frees all the resources allocated by this performance counter instance.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void To be added

  Frees the performance counter library shared state allocated by the counters.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.ComponentModel.ReadOnly(true)
  System.Diagnostics.MonitoringDescription("A description describing the counter.")
  System.MonoTODO
  System.String To be added: an object of type 'string'

  The Add Counters dialog box of the Performance Counter Manager MMC snap in displays the text when a user selects a counter from the counters list and clicks the Explain button.

  When you create a new counter, use the text to describe what the counter monitors do so the user can determine whether to add the counter to the System Monitor's display.

  If the value for the property is and the performance counter category was created with .NET Framework version 1.0 or 1.1, an is thrown. Performance counter categories created with earlier versions use global shared memory, and the value for must be . If the category is not used by applications running on versions 1.0 or 1.1 of the .NET Framework, delete and recreate the category.

  To read performance counters in Windows Vista, Windows XP Professional x64 Edition, or Windows Server 2003, you must either be a member of the Performance Monitor Users group or have administrative privileges.

  To avoid having to elevate your privileges to access performance counters in Windows Vista, add yourself to the Performance Monitor Users group.

  In Windows Vista, User Account Control (UAC) determines the privileges of a user. If you are a member of the Built-in Administrators group, you are assigned two run-time access tokens: a standard user access token and an administrator access token. By default, you are in the standard user role. To execute the code that accesses performance counters, you must first elevate your privileges from standard user to administrator. You can do this when you start an application by right-clicking the application icon and indicating that you want to run as an administrator.

  Gets the description for this performance counter.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DefaultValue("")
  System.ComponentModel.ReadOnly(true)
  System.ComponentModel.RecommendedAsConfigurable(true)
  System.ComponentModel.TypeConverter("System.Diagnostics.Design.CounterNameConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
  System.String To be added: an object of type 'string'

  You can get a list of available pre-existing counters from the Windows Performance Manager’s Add Counters dialog box.

  Gets or sets the name of the performance counter that is associated with this instance.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The type of the counter.")
  System.Diagnostics.PerformanceCounterType To be added: an object of type 'PerformanceCounterType'

  The enumeration contains the types of performance counters that you can interact with. Some of the counter types represent calculated values, such as the average of the counter measurements the system has taken. Other types represent raw, or uncalculated, values. The following table shows the counter types that you will interact with most frequently.

  Counter's Responsibility

  PerformanceCounterType Value

  Example

  Maintain a simple count of items or operations.

  NumberOfItems32

  Tracking the number of orders received as a 32-bit integer.

  Maintain a higher-capacity simple count.

  NumberOfItems64

  Tracking the number of orders for a site with very high volume, stored as a 64-bit integer.

  Track the number of items or operations per second.

  RateOfCountsPerSecond32

  Tracking orders received per second on a site.

  Track a higher-capacity number of items or operations per second.

  RateOfCountsPerSecond64

  Tracking orders received per second on a site with very high volume.

  Calculate the average time to perform a process or to process an item

  AverageTimer32

  Calculate the average time an order takes to be processed.

  When you create a counter whose type requires the use of a corresponding base counter, you must declare the counter and the base in the you pass into the method.

  If the value for the property is and the performance counter category was created with .NET Framework version 1.0 or 1.1, an is thrown. Performance counter categories created with earlier versions use global shared memory, and the value for must be . If the category is not used by applications running on versions 1.0 or 1.1 of the .NET Framework, delete and recreate the category.

  To read performance counters in Windows Vista, Windows XP Professional x64 Edition, or Windows Server 2003, you must either be a member of the Performance Monitor Users group or have administrative privileges.

  To avoid having to elevate your privileges to access performance counters in Windows Vista, add yourself to the Performance Monitor Users group.

  In Windows Vista, User Account Control (UAC) determines the privileges of a user. If you are a member of the Built-in Administrators group, you are assigned two run-time access tokens: a standard user access token and an administrator access token. By default, you are in the standard user role. To execute the code that accesses performance counters, you must first elevate your privileges from standard user to administrator. You can do this when you start an application by right-clicking the application icon and indicating that you want to run as an administrator.

  Gets the counter type of the associated performance counter.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int64

  You can write only to custom counters. All system counters are read-only.

  The , , and methods use interlocks to update the counter value. This helps keep the counter value accurate in multithreaded or multiprocess scenarios, but also results in a performance penalty. If you do not need the accuracy that interlocked operations provide, you can update the property directly for up to a 5 times performance improvement. However, in multithreaded scenarios, some updates to the counter value might be ignored, resulting in inaccurate data.

  If the value for the property is and the performance counter category was created with .NET Framework version 1.0 or 1.1, an is thrown. Performance counter categories created with earlier versions use global shared memory, and the value for must be . If the category is not used by applications running on versions 1.0 or 1.1 of the .NET Framework, delete and recreate the category.

  Decrements the associated performance counter by one through an efficient atomic operation.

  The decremented counter value.

- Field
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Obsolete
  System.Int32 To be added

  Specifies the size, in bytes, of the global memory shared by performance counters. The default size is 524,288 bytes.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` To be added: an object of type 'bool' To be added To be added
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void

  The vsprvslong design environment uses this method to end the initialization of a component that is used on a form or by another component. The method starts the initialization. Using the and methods prevents the component from being used before it is fully initialized.

  Ends the initialization of a instance that is used on a form or by another component. The initialization occurs at runtime.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int64

  You can write only to custom counters. All system counters are read-only.

  The , , and methods use interlocks to update the counter value. This helps keep the counter value accurate in multithreaded or multiprocess scenarios, but also results in a performance penalty. If you do not need the accuracy that interlocked operations provide, you can update the property directly for up to a 5 times performance improvement. However, in multithreaded scenarios, some updates to the counter value might be ignored, resulting in inaccurate data.

  If the value for the property is and the performance counter category was created with .NET Framework version 1.0 or 1.1, an is thrown. Performance counter categories created with earlier versions use global shared memory, and the value for must be . If the category is not used by applications running on versions 1.0 or 1.1 of the .NET Framework, delete and recreate the category.

  Increments the associated performance counter by one through an efficient atomic operation.

  The incremented counter value.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Int64 ``

  You can write only to custom counters. All system counters are read-only.

  The , , and methods use interlocks to update the counter value. This helps keep the counter value accurate in multithreaded or multiprocess scenarios, but also results in a performance penalty. If you do not need the accuracy that interlocked operations provide, you can update the property directly for up to a 5 times performance improvement. However, in multithreaded scenarios, some updates to the counter value might be ignored, resulting in inaccurate data.

  If the value forthe property is and the performance counter category was created with .NET Framework version 1.0 or 1.1, an is thrown. Performance counter categories created with earlier versions use global shared memory, and the value for must be . If the category is not used by applications running on versions 1.0 or 1.1 of the .NET Framework, delete and recreate the category.

  Increments or decrements the value of the associated performance counter by a specified amount through an efficient atomic operation.

  The new counter value.

  The value to increment by. (A negative value decrements the counter.)
- Property
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DefaultValue(Mono.Cecil.CustomAttributeArgument)
  System.MonoTODO
  System.Diagnostics.PerformanceCounterInstanceLifetime To be added.

  If the performance counter category is created with the .NET Framework version 1.0 or 1.1, it uses global shared memory, and the value for must be . If the category is not used by applications running on versions 1.0 or 1.1 of the .NET Framework, delete and recreate the category.

  If the value of the property is , the value for the performance counter must be .

  Gets or sets the lifetime of a process.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.DefaultValue("")
  System.ComponentModel.ReadOnly(true)
  System.ComponentModel.RecommendedAsConfigurable(true)
  System.ComponentModel.TypeConverter("System.Diagnostics.Design.InstanceNameConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
  System.String To be added: an object of type 'string'

  Instance names must be shorter than 128 characters in length.

  In some situations, categories are subdivided into instances, which track data about multiple occurrences of the object that a category relates to. Instances apply to the category as whole, rather than to individual counters. Every counter within a category has each instance defined for the category. For example, the Process category contains instances named Idle and System. Every counter within the Process category thus contains data for each instance, showing information about either idle processes or system processes.

  Many categories do not contain multiple instances, so you can leave this property empty to indicate that no instance is associated with the category.

  If this instance points to a noncustom category, you can choose from only the existing category instances. You can create new category instances only in custom categories, which allow you to define as many counters and category instances as you need.

  To create a performance category instance, specify an on the constructor. If the category instance specified by already exists the new object will reference the existing category instance.

  Do not use the characters "(", ")", "#", "\", or "/" in the instance name. If any of these characters are used, the Performance Console (see Runtime Profiling) may not correctly display the instance values.

  If the instance name is automatically generated and might contain the characters "(", ")", "#", "\", or "/", use the character mapping in the following table.

  Character

  Mapped character

  (

  [

  )

  ]

  #

  _

  \

  _

  /

  _

  The property of the object obtained from the property is a common source of instance names that can contain invalid characters.

  Gets or sets an instance name for this performance counter.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.Browsable(false)
  System.ComponentModel.DefaultValue(".")
  System.ComponentModel.RecommendedAsConfigurable(true)
  System.MonoTODO("What's the machine name format?")
  System.String To be added: an object of type 'string'

  You can write values only to counters that reside on the local computer. However, you can read counter values from any computer in the enterprise for which you have access privileges.

  When you set the property to point to a remote computer, the instance attempts to open the counter on that computer. If the counter does not exist, setting this property throws an exception.

  Gets or sets the computer name for this performance counter

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Diagnostics.CounterSample

  This method is generally used for counters that contain uncalculated values.

  If the value for the property is and the performance counter category was created with .NET Framework version 1.0 or 1.1, an is thrown. Performance counter categories created with earlier versions use global shared memory, and the value for must be . If the category is not used by applications running on versions 1.0 or 1.1 of the .NET Framework, delete and recreate the category.

  To read performance counters in Windows Vista, Windows XP Professional x64 Edition, or Windows Server 2003, you must either be a member of the Performance Monitor Users group or have administrative privileges.

  To avoid having to elevate your privileges to access performance counters in Windows Vista, add yourself to the Performance Monitor Users group.

  In Windows Vista, User Account Control (UAC) determines the privileges of a user. If you are a member of the Built-in Administrators group, you are assigned two run-time access tokens: a standard user access token and an administrator access token. By default, you are in the standard user role. To execute the code that accesses performance counters, you must first elevate your privileges from standard user to administrator. You can do this when you start an application by right-clicking the application icon and indicating that you want to run as an administrator.

  Obtains a counter sample, and returns the raw, or uncalculated, value for it.

  A that represents the next raw value that the system obtains for this counter.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Single

  If the calculated value of a counter depends on two counter reads, the first read operation returns 0.0. Resetting the performance counter properties to specify a different counter is equivalent to creating a new performance counter, and the first read operation using the new properties returns 0.0. The recommended delay time between calls to the method is one second, to allow the counter to perform the next incremental read.

  To read performance counters, you must have administrative privileges. In Windows Vista, User Account Control (UAC) determines the privileges of a user. If you are a member of the Built-in Administrators group, you are assigned two run-time access tokens: a standard user access token and an administrator access token. By default, you are in the standard user role. To execute the code that accesses performance counters, you must first elevate your privileges from standard user to administrator. You can do this when you start an application by right-clicking the application icon and indicating that you want to run as an administrator.

  Obtains a counter sample and returns the calculated value for it.

  The next calculated value that the system obtains for this counter.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.Browsable(false)
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Diagnostics.MonitoringDescription("The raw value of the counter.")
  System.Int64 To be added: an object of type 'long'

  If the counter type is a 32-bit size and you attempt to set this property to a value that is too large to fit, the property truncates the value to 32 bits. When reading custom counters on the local computer, using the property rather than a calculated value can produce significantly better performance in scenarios where the raw value is sufficient.

  If the counter that you are reading is read-only, getting the property samples the counter at the time that the property is called. This action is equivalent to making an initial call to the method. If you subsequently call , you can perform calculations on the values that both calls returned.

  Because system counters are read-only, you can get but not set their raw values.

  The , , and methods use interlocks to update the counter value. This helps keep the counter value accurate in multithreaded or multiprocess scenarios, but also results in a performance penalty. If you do not need the accuracy that interlocked operations provide, you can update the property directly for up to a 5 times performance improvement. However, in multithreaded scenarios, some updates to the counter value might be ignored, resulting in inaccurate data.

  If the value for the property is and the performance counter category was created with .NET Framework version 1.0 or 1.1, an is thrown. Performance counter categories created with earlier versions use global shared memory, and the value for must be . If the category is not used by applications running on versions 1.0 or 1.1 of the .NET Framework, delete and recreate the category.

  To read performance counters in Windows Vista, Windows XP Professional x64 Edition, or Windows Server 2003, you must either be a member of the Performance Monitor Users group or have administrative privileges.

  To avoid having to elevate your privileges to access performance counters in Windows Vista, add yourself to the Performance Monitor Users group.

  In Windows Vista, User Account Control (UAC) determines the privileges of a user. If you are a member of the Built-in Administrators group, you are assigned two run-time access tokens: a standard user access token and an administrator access token. By default, you are in the standard user role. To execute the code that accesses performance counters, you must first elevate your privileges from standard user to administrator. You can do this when you start an application by right-clicking the application icon and indicating that you want to run as an administrator.

  Gets or sets the raw, or uncalculated, value of this counter.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.ComponentModel.Browsable(false)
  System.ComponentModel.DefaultValue(true)
  System.Diagnostics.MonitoringDescription("The accessability level of the counter.")
  System.Boolean To be added: an object of type 'bool'

  For a system counter, should always true. You cannot write to a system counter.

  Gets or sets a value indicating whether this instance is in read-only mode.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.MonoTODO
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.MayFail)
  System.Void

  You can remove an instance only for a custom counter. All system counters are read-only, so attempting to remove one of them throws an exception.

  To avoid a possible race condition when the performance counter shared memory is released, it is recommended that the method be called from the event handler.

  To create a performance category instance, specify an on the constructor. If the category instance specified by already exists the new object will reference the existing category instance.

  If the value for the property is and the performance counter category was created with .NET Framework version 1.0 or 1.1, an is thrown. Performance counter categories created with earlier versions use global shared memory, and the value for must be . If the category is not used by applications running on versions 1.0 or 1.1 of the .NET Framework, delete and recreate the category.

  Deletes the category instance specified by the object property.