PerformanceCounterInstaller PerformanceCounterInstaller PerformanceCounterInstaller PerformanceCounterInstaller Class

Definition

Specifies an installer for the PerformanceCounter component.

public ref class PerformanceCounterInstaller : System::Configuration::Install::ComponentInstaller
public class PerformanceCounterInstaller : System.Configuration.Install.ComponentInstaller
type PerformanceCounterInstaller = class
    inherit ComponentInstaller
Public Class PerformanceCounterInstaller
Inherits ComponentInstaller
Inheritance

Examples

The following code example demonstrates how to create a PerformanceCounterInstaller object and add it to an InstallerCollection.

#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)]
ref class MyPerformanceCounterInstaller: public Installer
{
public:
   MyPerformanceCounterInstaller()
   {
      try
      {
         // Create an instance of 'PerformanceCounterInstaller'.
         PerformanceCounterInstaller^ myPerformanceCounterInstaller =
            gcnew PerformanceCounterInstaller;
         // Set the 'CategoryName' for performance counter.
         myPerformanceCounterInstaller->CategoryName =
            "MyPerformanceCounter";
         CounterCreationData^ myCounterCreation = gcnew 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 ) 
      {
		  this->Context->LogMessage( "Error occured : " + e->Message );
      }
   }
};
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)
        {
            this.Context.LogMessage("Error occured :" + e.Message);
        }
    }
    public static void Main()
    {
    }
}
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
            Me.Context.LogMessage("Error occured :" + e.Message)
        End Try
    End Sub 'New
    Public Shared Sub Main()
    End Sub 'Main
End Class 'MyPerformanceCounterInstaller

Remarks

The following information might help provide a performance improvement when installing performance counters at application startup. Performance counter categories installed with .NET Framework version 2.0 use separate shared memories, 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.

Constructors

PerformanceCounterInstaller() PerformanceCounterInstaller() PerformanceCounterInstaller() PerformanceCounterInstaller()

Initializes a new instance of the PerformanceCounterInstaller class.

Properties

CanRaiseEvents CanRaiseEvents CanRaiseEvents CanRaiseEvents

Gets a value indicating whether the component can raise an event.

(Inherited from Component)
CategoryHelp CategoryHelp CategoryHelp CategoryHelp

Gets or sets the descriptive message for the performance counter.

CategoryName CategoryName CategoryName CategoryName

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

CategoryType CategoryType CategoryType CategoryType

Gets or sets the performance counter category type.

Container Container Container Container

Gets the IContainer that contains the Component.

(Inherited from Component)
Context Context Context Context

Gets or sets information about the current installation.

(Inherited from Installer)
Counters Counters Counters Counters

Gets a collection of data that pertains to the counters to install.

DesignMode DesignMode DesignMode DesignMode

Gets a value that indicates whether the Component is currently in design mode.

(Inherited from Component)
Events Events Events Events

Gets the list of event handlers that are attached to this Component.

(Inherited from Component)
HelpText HelpText HelpText HelpText

Gets the help text for all the installers in the installer collection.

(Inherited from Installer)
Installers Installers Installers Installers

Gets the collection of installers that this installer contains.

(Inherited from Installer)
Parent Parent Parent Parent

Gets or sets the installer containing the collection that this installer belongs to.

(Inherited from Installer)
Site Site Site Site

Gets or sets the ISite of the Component.

(Inherited from Component)
UninstallAction UninstallAction UninstallAction UninstallAction

Gets a value that indicates whether the performance counter should be removed at uninstall time.

Methods

Commit(IDictionary) Commit(IDictionary) Commit(IDictionary) Commit(IDictionary)

When overridden in a derived class, completes the install transaction.

(Inherited from Installer)
CopyFromComponent(IComponent) CopyFromComponent(IComponent) CopyFromComponent(IComponent) CopyFromComponent(IComponent)

Copies all the properties from the specified component that are required at install time for a performance counter.

CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(Inherited from MarshalByRefObject)
Dispose() Dispose() Dispose() Dispose()

Releases all resources used by the Component.

(Inherited from Component)
Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

Releases the unmanaged resources used by the Component and optionally releases the managed resources.

(Inherited from Component)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetLifetimeService() GetLifetimeService() GetLifetimeService() GetLifetimeService()

Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetService(Type) GetService(Type) GetService(Type) GetService(Type)

Returns an object that represents a service provided by the Component or by its Container.

(Inherited from Component)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService()

Obtains a lifetime service object to control the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
Install(IDictionary) Install(IDictionary) Install(IDictionary) Install(IDictionary)

Performs the installation.

IsEquivalentInstaller(ComponentInstaller) IsEquivalentInstaller(ComponentInstaller) IsEquivalentInstaller(ComponentInstaller) IsEquivalentInstaller(ComponentInstaller)

Determines if the specified installer installs the same object as this installer.

(Inherited from ComponentInstaller)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean)

Creates a shallow copy of the current MarshalByRefObject object.

(Inherited from MarshalByRefObject)
OnAfterInstall(IDictionary) OnAfterInstall(IDictionary) OnAfterInstall(IDictionary) OnAfterInstall(IDictionary)

Raises the AfterInstall event.

(Inherited from Installer)
OnAfterRollback(IDictionary) OnAfterRollback(IDictionary) OnAfterRollback(IDictionary) OnAfterRollback(IDictionary)

Raises the AfterRollback event.

(Inherited from Installer)
OnAfterUninstall(IDictionary) OnAfterUninstall(IDictionary) OnAfterUninstall(IDictionary) OnAfterUninstall(IDictionary)

Raises the AfterUninstall event.

(Inherited from Installer)
OnBeforeInstall(IDictionary) OnBeforeInstall(IDictionary) OnBeforeInstall(IDictionary) OnBeforeInstall(IDictionary)

Raises the BeforeInstall event.

(Inherited from Installer)
OnBeforeRollback(IDictionary) OnBeforeRollback(IDictionary) OnBeforeRollback(IDictionary) OnBeforeRollback(IDictionary)

Raises the BeforeRollback event.

(Inherited from Installer)
OnBeforeUninstall(IDictionary) OnBeforeUninstall(IDictionary) OnBeforeUninstall(IDictionary) OnBeforeUninstall(IDictionary)

Raises the BeforeUninstall event.

(Inherited from Installer)
OnCommitted(IDictionary) OnCommitted(IDictionary) OnCommitted(IDictionary) OnCommitted(IDictionary)

Raises the Committed event.

(Inherited from Installer)
OnCommitting(IDictionary) OnCommitting(IDictionary) OnCommitting(IDictionary) OnCommitting(IDictionary)

Raises the Committing event.

(Inherited from Installer)
Rollback(IDictionary) Rollback(IDictionary) Rollback(IDictionary) Rollback(IDictionary)

Restores the computer to the state it was in before the installation.

ToString() ToString() ToString() ToString()

Returns a String containing the name of the Component, if any. This method should not be overridden.

(Inherited from Component)
Uninstall(IDictionary) Uninstall(IDictionary) Uninstall(IDictionary) Uninstall(IDictionary)

Removes an installation.

Events

AfterInstall AfterInstall AfterInstall AfterInstall

Occurs after the Install(IDictionary) methods of all the installers in the Installers property have run.

(Inherited from Installer)
AfterRollback AfterRollback AfterRollback AfterRollback

Occurs after the installations of all the installers in the Installers property are rolled back.

(Inherited from Installer)
AfterUninstall AfterUninstall AfterUninstall AfterUninstall

Occurs after all the installers in the Installers property perform their uninstallation operations.

(Inherited from Installer)
BeforeInstall BeforeInstall BeforeInstall BeforeInstall

Occurs before the Install(IDictionary) method of each installer in the installer collection has run.

(Inherited from Installer)
BeforeRollback BeforeRollback BeforeRollback BeforeRollback

Occurs before the installers in the Installers property are rolled back.

(Inherited from Installer)
BeforeUninstall BeforeUninstall BeforeUninstall BeforeUninstall

Occurs before the installers in the Installers property perform their uninstall operations.

(Inherited from Installer)
Committed Committed Committed Committed

Occurs after all the installers in the Installers property have committed their installations.

(Inherited from Installer)
Committing Committing Committing Committing

Occurs before the installers in the Installers property commit their installations.

(Inherited from Installer)
Disposed Disposed Disposed Disposed

Occurs when the component is disposed by a call to the Dispose() method.

(Inherited from Component)

Applies to