This topic has not yet been rated - Rate this topic

PerformanceCounterInstaller Class

Specifies an installer for the PerformanceCounter component.

System.Object
  System.MarshalByRefObject
    System.ComponentModel.Component
      System.Configuration.Install.Installer
        System.Configuration.Install.ComponentInstaller
          System.Diagnostics.PerformanceCounterInstaller

Namespace:  System.Diagnostics
Assembly:  System.Configuration.Install (in System.Configuration.Install.dll)
public class PerformanceCounterInstaller : ComponentInstaller

The PerformanceCounterInstaller type exposes the following members.

  Name Description
Public method PerformanceCounterInstaller Initializes a new instance of the PerformanceCounterInstaller class.
Top
  Name Description
Protected property CanRaiseEvents Gets a value indicating whether the component can raise an event. (Inherited from Component.)
Public property CategoryHelp Gets or sets the descriptive message for the performance counter.
Public property CategoryName Gets or sets the performance category name for the performance counter.
Public property CategoryType Gets or sets the performance counter category type.
Public property Container Gets the IContainer that contains the Component. (Inherited from Component.)
Public property Context Gets or sets information about the current installation. (Inherited from Installer.)
Public property Counters Gets a collection of data that pertains to the counters to install.
Protected property DesignMode Gets a value that indicates whether the Component is currently in design mode. (Inherited from Component.)
Protected property Events Gets the list of event handlers that are attached to this Component. (Inherited from Component.)
Public property HelpText Gets the help text for all the installers in the installer collection. (Inherited from Installer.)
Public property Installers Gets the collection of installers that this installer contains. (Inherited from Installer.)
Public property Parent Gets or sets the installer containing the collection that this installer belongs to. (Inherited from Installer.)
Public property Site Gets or sets the ISite of the Component. (Inherited from Component.)
Public property UninstallAction Gets a value that indicates whether the performance counter should be removed at uninstall time.
Top
  Name Description
Public method Commit When overridden in a derived class, completes the install transaction. (Inherited from Installer.)
Public method CopyFromComponent Copies all the properties from the specified component that are required at install time for a performance counter. (Overrides ComponentInstaller.CopyFromComponent(IComponent).)
Public method CreateObjRef Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.)
Public method Dispose() Releases all resources used by the Component. (Inherited from Component.)
Protected method Dispose(Boolean) Releases the unmanaged resources used by the Component and optionally releases the managed resources. (Inherited from Component.)
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Releases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection. (Inherited from Component.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetLifetimeService Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Protected method GetService Returns an object that represents a service provided by the Component or by its Container. (Inherited from Component.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method InitializeLifetimeService Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public method Install Performs the installation. (Overrides Installer.Install(IDictionary).)
Public method IsEquivalentInstaller Determines if the specified installer installs the same object as this installer. (Inherited from ComponentInstaller.)
Protected method MemberwiseClone() Creates a shallow copy of the current Object. (Inherited from Object.)
Protected method MemberwiseClone(Boolean) Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.)
Protected method OnAfterInstall Raises the AfterInstall event. (Inherited from Installer.)
Protected method OnAfterRollback Raises the AfterRollback event. (Inherited from Installer.)
Protected method OnAfterUninstall Raises the AfterUninstall event. (Inherited from Installer.)
Protected method OnBeforeInstall Raises the BeforeInstall event. (Inherited from Installer.)
Protected method OnBeforeRollback Raises the BeforeRollback event. (Inherited from Installer.)
Protected method OnBeforeUninstall Raises the BeforeUninstall event. (Inherited from Installer.)
Protected method OnCommitted Raises the Committed event. (Inherited from Installer.)
Protected method OnCommitting Raises the Committing event. (Inherited from Installer.)
Public method Rollback Restores the computer to the state it was in before the installation. (Overrides Installer.Rollback(IDictionary).)
Public method ToString Returns a String containing the name of the Component, if any. This method should not be overridden. (Inherited from Component.)
Public method Uninstall Removes an installation. (Overrides Installer.Uninstall(IDictionary).)
Top
  Name Description
Public event AfterInstall Occurs after the Install methods of all the installers in the Installers property have run. (Inherited from Installer.)
Public event AfterRollback Occurs after the installations of all the installers in the Installers property are rolled back. (Inherited from Installer.)
Public event AfterUninstall Occurs after all the installers in the Installers property perform their uninstallation operations. (Inherited from Installer.)
Public event BeforeInstall Occurs before the Install method of each installer in the installer collection has run. (Inherited from Installer.)
Public event BeforeRollback Occurs before the installers in the Installers property are rolled back. (Inherited from Installer.)
Public event BeforeUninstall Occurs before the installers in the Installers property perform their uninstall operations. (Inherited from Installer.)
Public event Committed Occurs after all the installers in the Installers property have committed their installations. (Inherited from Installer.)
Public event Committing Occurs before the installers in the Installers property committ their installations. (Inherited from Installer.)
Public event Disposed Occurs when the component is disposed by a call to the Dispose method. (Inherited from Component.)
Top

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.

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


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()
    {
    }
}


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ