¿Le resultó útil esta página?
Sus comentarios sobre este contenido son muy importantes. Háganos saber su opinión.
¿Tiene comentarios adicionales?
Caracteres restantes: 1500
Exportar (0) Imprimir
Expandir todo
EN
Este contenido no se encuentra disponible en su idioma, pero aquí tiene la versión en inglés.

PerformanceCounterInstaller Class

Specifies an installer for the PerformanceCounter component.

Namespace: System.Diagnostics
Assembly: System.Configuration.Install (in system.configuration.install.dll)

public class PerformanceCounterInstaller : ComponentInstaller
public class PerformanceCounterInstaller extends ComponentInstaller
public class PerformanceCounterInstaller extends ComponentInstaller
Not applicable.

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)
      {
         Console.WriteLine("Error occured :"+e.Message);
      }
   }
   public static void Main()
   {
   }
}

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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Adiciones de comunidad

AGREGAR
Mostrar:
© 2015 Microsoft