PerformanceCounterInstaller Class
Specifies an installer for the PerformanceCounter component.
Assembly: System.Configuration.Install (in System.Configuration.Install.dll)
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.
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
System.MarshalByRefObject
System.ComponentModel.Component
System.Configuration.Install.Installer
System.Configuration.Install.ComponentInstaller
System.Diagnostics.PerformanceCounterInstaller
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.