Share via


Registry.PerformanceData Campo

Definición

Contiene información de rendimiento de los componentes de software. Este campo lee la clave base HKEY_PERFORMANCE_DATA del Registro de Windows.

public: static initonly Microsoft::Win32::RegistryKey ^ PerformanceData;
public static readonly Microsoft.Win32.RegistryKey PerformanceData;
 staticval mutable PerformanceData : Microsoft.Win32.RegistryKey
Public Shared ReadOnly PerformanceData As RegistryKey 

Valor de campo

Ejemplos

En el ejemplo siguiente se muestra cómo recuperar las subclaves de esta clave e imprimir sus nombres en la pantalla. Use el OpenSubKey método para crear una instancia de la subclave concreta de interés. Después, puede usar otras operaciones en RegistryKey para manipular esa clave. Tenga en cuenta que este ejemplo a menudo no puede devolver ningún resultado, ya que es posible que no haya datos de rendimiento.

using namespace System;
using namespace Microsoft::Win32;
void PrintKeys( RegistryKey ^ rkey )
{
   
   // Retrieve all the subkeys for the specified key.
   array<String^>^names = rkey->GetSubKeyNames();
   int icount = 0;
   Console::WriteLine( "Subkeys of {0}", rkey->Name );
   Console::WriteLine( "-----------------------------------------------" );
   
   // Print the contents of the array to the console.
   System::Collections::IEnumerator^ enum0 = names->GetEnumerator();
   while ( enum0->MoveNext() )
   {
      String^ s = safe_cast<String^>(enum0->Current);
      Console::WriteLine( s );
      
      // The following code puts a limit on the number
      // of keys displayed.  Comment it out to print the
      // complete list.
      icount++;
      if ( icount >= 10 )
            break;
   }
}

int main()
{
   
   // Create a RegistryKey, which will access the HKEY_PERFORMANCE_DATA
   // key in the registry of this machine.
   RegistryKey ^ rk = Registry::PerformanceData;
   
   // Print out the keys.
   PrintKeys( rk );
}
using System;
using Microsoft.Win32;

class Reg {
    public static void Main() {

        // Create a RegistryKey, which will access the HKEY_PERFORMANCE_DATA
        // key in the registry of this machine.
        RegistryKey rk = Registry.PerformanceData;

        // Print out the keys.
        PrintKeys(rk);
    }

    static void PrintKeys(RegistryKey rkey) {

        // Retrieve all the subkeys for the specified key.
        string [] names = rkey.GetSubKeyNames();

        int icount = 0;

        Console.WriteLine("Subkeys of " + rkey.Name);
        Console.WriteLine("-----------------------------------------------");

        // Print the contents of the array to the console.
        foreach (string s in names) {
            Console.WriteLine(s);

            // The following code puts a limit on the number
            // of keys displayed.  Comment it out to print the
            // complete list.
            icount++;
            if (icount >= 10)
                break;
        }
    }
}
Imports Microsoft.Win32

Class Reg
    
    Public Shared Sub Main()
        
        ' Create a RegistryKey, which will access the HKEY_PERFORMANCE_DATA 
        ' key in the registry of this machine.
        Dim rk As RegistryKey = Registry.PerformanceData
        
        ' Print out the keys.
        PrintKeys(rk)
    End Sub    
    
    Shared Sub PrintKeys(rkey As RegistryKey)
        
        ' Retrieve all the subkeys for the specified key.
        Dim names As String() = rkey.GetSubKeyNames()
        
        Dim icount As Integer = 0
        
        Console.WriteLine("Subkeys of " & rkey.Name)
        Console.WriteLine("-----------------------------------------------")
        
        ' Print the contents of the array to the console.
        Dim s As String
        For Each s In  names
            Console.WriteLine(s)
            
            ' The following code puts a limit on the number
            ' of keys displayed.  Comment it out to print the
            ' complete list.
            icount += 1            
            If icount >= 10 Then
                Exit For
            End If
        Next s
    End Sub
End Class

Comentarios

Cada componente de software crea claves para sus objetos, contadores cuando está instalado y escribe datos de contador mientras se ejecuta. Puede acceder a estos datos, ya que accedería a cualquier otro dato del Registro, mediante las RegistryKey funciones .

Aunque se usa el registro para recopilar datos de rendimiento, los datos no se almacenan en la base de datos del Registro. En su lugar, el acceso al Registro con esta clave hace que el sistema recopile los datos de los administradores de objetos del sistema adecuados.

Para obtener datos de rendimiento del sistema local, use el GetValue método , con la clave Registry.PerformanceData. La primera llamada abre la clave (no es necesario abrirla explícitamente primero). Sin embargo, asegúrese de usar el Close método para cerrar el identificador de la clave cuando haya terminado de obtener datos de rendimiento. El usuario no puede instalar ni quitar un componente de software mientras sus datos de rendimiento están en uso.

Para obtener datos de rendimiento de un sistema remoto, debe usar el OpenRemoteBaseKey método , con el nombre de equipo del sistema remoto y la clave Registry.PerformanceData. Esta llamada recupera una clave que representa los datos de rendimiento del sistema remoto. Para recuperar los datos, llame a GetValue mediante esta clave, en lugar de la clave Registry.PerformanceData.

Nota

En Windows Server 2003, un usuario debe pertenecer al grupo usuarios de Monitor de rendimiento para acceder a las subclaves de esta clave base.

Se aplica a