Registry.PerformanceData フィールド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
ソフトウェア コンポーネントのパフォーマンス情報が含まれています。 このフィールドは、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 メソッドを使用して、対象の特定のサブキーのインスタンスを作成します。 その後、 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 を呼び出します。
Note
Windows Server 2003 では、この基本キーのサブキーにアクセスするには、少なくともユーザーが パフォーマンス モニター Users グループに属している必要があります。