Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Gibt ein Installationsprogramm für die PerformanceCounter-Komponente an.
Namespace: System.Diagnostics
Assembly: System.Configuration.Install (in system.configuration.install.dll)
Syntax
'Declaration
Public Class PerformanceCounterInstaller
Inherits ComponentInstaller
'Usage
Dim instance As PerformanceCounterInstaller
public class PerformanceCounterInstaller : ComponentInstaller
public ref class PerformanceCounterInstaller : public ComponentInstaller
public class PerformanceCounterInstaller extends ComponentInstaller
public class PerformanceCounterInstaller extends ComponentInstaller
Hinweise
Die folgenden Informationen eine Leistungsverbesserung erleichtern, wenn Leistungsindikatoren bei Anwendungsstart installiert werden. Leistungsindikatorkategorien, die mit .NET Framework, Version 2.0, installiert werden, verwenden getrennte gemeinsam genutzte Speicherbereiche, bei denen jeder Leistungsindikator über einen eigenen Speicherbereich verfügt. Sie können die Größe der getrennten gemeinsam genutzten Speicherbereiche angeben, indem Sie einen DWORD-Registrierungsschlüssel HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<Kategoriename>\Performance\FileMappingSize mit einem Wert wie 131072, dem aktuellen Standardwert, erstellen. Wenn der Registrierungsschlüssel nicht vorhanden ist, wird der fileMappingSize-Attributwert für das in der Datei machine.config angegebene performanceCounters-Element verwendet, was zu zusätzlichem Aufwand für die Verarbeitung der Konfigurationsdatei führt. Durch die Verwendung des Registrierungsschlüssels können Sie eine Leistungsverbesserung beim Anwendungsstart erreichen.
Beispiel
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
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()
{
}
}
#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 )
{
Console::WriteLine( "Error occured :{0}", e->Message );
}
}
};
import System.*;
import System.Configuration.Install.*;
import System.Diagnostics.*;
import System.ComponentModel.*;
/** @attribute RunInstaller(true)
*/
public class MyPerformanceCounterInstaller extends Installer
{
public MyPerformanceCounterInstaller()
{
try {
// Create an instance of 'PerformanceCounterInstaller'.
PerformanceCounterInstaller myPerformanceCounterInstaller =
new PerformanceCounterInstaller();
// Set the 'CategoryName' for performance counter.
myPerformanceCounterInstaller.set_CategoryName(
"MyPerformanceCounter");
CounterCreationData myCounterCreation =
new CounterCreationData();
myCounterCreation.set_CounterName("MyCounter");
myCounterCreation.set_CounterHelp("Counter Help");
// Add a counter to collection of myPerformanceCounterInstaller.
myPerformanceCounterInstaller.get_Counters().Add(myCounterCreation);
InstallerCollection installers = null;
installers.Add(myPerformanceCounterInstaller);
}
catch (System.Exception e) {
Console.WriteLine("Error occured :" + e.get_Message());
}
} //MyPerformanceCounterInstaller
public static void main(String[] args)
{
} //main
} //MyPerformanceCounterInstaller
Vererbungshierarchie
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
System.Configuration.Install.Installer
System.Configuration.Install.ComponentInstaller
System.Diagnostics.PerformanceCounterInstaller
Threadsicherheit
Alle öffentlichen statischen (Shared in Visual Basic) Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.
Plattformen
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
Siehe auch
Referenz
PerformanceCounterInstaller-Member
System.Diagnostics-Namespace