PerformanceCounterInstaller Class
Specifies an installer for the PerformanceCounter component.
For a list of all members of this type, see PerformanceCounterInstaller Members.
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
System.Configuration.Install.Installer
System.Configuration.Install.ComponentInstaller
System.Diagnostics.PerformanceCounterInstaller
[Visual Basic] Public Class PerformanceCounterInstaller Inherits ComponentInstaller [C#] public class PerformanceCounterInstaller : ComponentInstaller [C++] public __gc class PerformanceCounterInstaller : public ComponentInstaller [JScript] public class PerformanceCounterInstaller extends ComponentInstaller
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Example
[Visual Basic] Imports System Imports System.Configuration.Install Imports System.Diagnostics Imports System.ComponentModel <RunInstaller(True)> _ Public Class MyPerformanceCounterInstaller Inherits Installer Public Sub New() Try ' Create an instance of 'PerformanceCounterInstaller'. Dim myPerformanceCounterInstaller As New PerformanceCounterInstaller() ' Set the 'CategoryName' for performance counter. myPerformanceCounterInstaller.CategoryName = "MyPerformanceCounter" Dim myCounterCreation As New CounterCreationData() myCounterCreation.CounterName = "MyCounter" myCounterCreation.CounterHelp = "Counter Help" ' Add a counter to collection of myPerformanceCounterInstaller. myPerformanceCounterInstaller.Counters.Add(myCounterCreation) Installers.Add(myPerformanceCounterInstaller) Catch e As Exception Console.WriteLine("Error occured :" + e.Message) End Try End Sub 'New Public Shared Sub Main() End Sub 'Main End Class 'MyPerformanceCounterInstaller [C#] using System; using System.Configuration.Install; using System.Diagnostics; using System.ComponentModel; [RunInstaller(true)] public class MyPerformanceCounterInstaller: Installer { public MyPerformanceCounterInstaller() { try { // Create an instance of 'PerformanceCounterInstaller'. PerformanceCounterInstaller myPerformanceCounterInstaller = new PerformanceCounterInstaller(); // Set the 'CategoryName' for performance counter. myPerformanceCounterInstaller.CategoryName = "MyPerformanceCounter"; CounterCreationData myCounterCreation = new CounterCreationData(); myCounterCreation.CounterName = "MyCounter"; myCounterCreation.CounterHelp = "Counter Help"; // Add a counter to collection of myPerformanceCounterInstaller. myPerformanceCounterInstaller.Counters.Add(myCounterCreation); Installers.Add(myPerformanceCounterInstaller); } catch(Exception e) { Console.WriteLine("Error occured :"+e.Message); } } public static void Main() { } } [C++] #using <mscorlib.dll> #using <System.dll> #using <System.Configuration.Install.dll> using namespace System; using namespace System::Configuration::Install; using namespace System::Diagnostics; using namespace System::ComponentModel; [RunInstaller(true)] __gc class MyPerformanceCounterInstaller: public Installer { public: MyPerformanceCounterInstaller() { try { // Create an instance of 'PerformanceCounterInstaller'. PerformanceCounterInstaller* myPerformanceCounterInstaller = new PerformanceCounterInstaller(); // Set the 'CategoryName' for performance counter. myPerformanceCounterInstaller->CategoryName = S"MyPerformanceCounter"; CounterCreationData* myCounterCreation = new CounterCreationData(); myCounterCreation->CounterName = S"MyCounter"; myCounterCreation->CounterHelp = S"Counter Help"; // Add a counter to collection of myPerformanceCounterInstaller. myPerformanceCounterInstaller->Counters->Add(myCounterCreation); Installers->Add(myPerformanceCounterInstaller); } catch (Exception* e) { Console::WriteLine(S"Error occured :{0}", e->Message); } } };
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Namespace: System.Diagnostics
Platforms: Windows NT Server 4.0, Windows NT Workstation 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: System.Configuration.Install (in System.Configuration.Install.dll)
See Also
PerformanceCounterInstaller Members | System.Diagnostics Namespace