Share via


Registry.PerformanceData 필드

정의

소프트웨어 구성 요소에 대한 성능 정보를 포함합니다. 이 필드는 Windows 레지스트리 기본 키 HKEY_PERFORMANCE_DATA를 읽습니다.

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 

필드 값

예제

다음 예제에서는 이 키의 하위 키를 검색하고 해당 이름을 화면에 출력하는 방법을 보여 줍니다. 메서드를 OpenSubKey 사용하여 관심 있는 특정 하위 키의 instance 만듭니다. 그런 다음 의 RegistryKey 다른 작업을 사용하여 해당 키를 조작할 수 있습니다. 이 예제에서는 성능 데이터가 없을 수 있으므로 결과를 반환하지 않는 경우가 많습니다.

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

설명

각 소프트웨어 구성 요소는 개체에 대한 키를 만들고, 설치할 때 카운터를 만들고, 실행되는 동안 카운터 데이터를 씁니다. 함수를 사용하여 RegistryKey 다른 레지스트리 데이터에 액세스하는 것처럼 이 데이터에 액세스할 수 있습니다.

레지스트리를 사용하여 성능 데이터를 수집하지만 데이터는 레지스트리 데이터베이스에 저장되지 않습니다. 대신, 이 키를 사용하여 레지스트리에 액세스하면 시스템이 적절한 시스템 개체 관리자로부터 데이터를 수집하게 됩니다.

로컬 시스템에서 성능 데이터를 가져오려면 Registry.PerformanceData 키와 함께 메서드를 사용합니다 GetValue . 첫 번째 호출은 키를 엽니다(먼저 명시적으로 키를 열 필요가 없음). 그러나 성능 데이터 가져오기가 Close 완료되면 메서드를 사용하여 키에 대한 핸들을 닫아야 합니다. 성능 데이터를 사용하는 동안에는 사용자가 소프트웨어 구성 요소를 설치하거나 제거할 수 없습니다.

원격 시스템에서 성능 데이터를 가져오려면 원격 시스템의 컴퓨터 이름 및 Registry.PerformanceData 키와 함께 메서드를 사용해야 OpenRemoteBaseKey 합니다. 이 호출은 원격 시스템의 성능 데이터를 나타내는 키를 검색합니다. 데이터를 검색하려면 Registry.PerformanceData 키가 아닌 이 키를 사용하여 를 호출 GetValue 합니다.

참고

이 기본 키의 하위 키에 액세스하려면 Windows Server 2003에서 사용자가 성능 모니터 사용자 그룹에 속해야 합니다.

적용 대상