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 完了したら、必ずこのメソッドを使用してキーのハンドルを閉じます。 パフォーマンス データが使用されている間、ユーザーはソフトウェア コンポーネントをインストールまたは削除できません。
リモート システムからパフォーマンス データを取得するには、リモート システムの OpenRemoteBaseKey コンピューター名と Registry.PerformanceData キーを使用して、メソッドを使用する必要があります。 この呼び出しは、リモート システムのパフォーマンス データを表すキーを取得します。 データを取得するには、Registry.PerformanceData キーではなく、このキーを使用して呼び出します GetValue 。
注意
Windows Server 2003 では、この基本キーのサブキーにアクセスするには、ユーザーが少なくとも パフォーマンス モニター Users グループに属している必要があります。