Registry.PerformanceData フィールド
アセンブリ: mscorlib (mscorlib.dll 内)
![構文](http://weblio.hs.llnwd.net/e7/img/dict/msdnc/minus.gif)
![解説](http://weblio.hs.llnwd.net/e7/img/dict/msdnc/minus.gif)
各ソフトウェア コンポーネントをインストールすると、そのコンポーネントのオブジェクト、つまりカウンタのキーが作成され、コンポーネントの実行時に、カウンタ データが書き込まれます。このデータにアクセスするには、その他のレジストリ データにアクセスする場合と同様に、RegistryKey 関数を使用します。
レジストリを使用してパフォーマンス データを収集しますが、収集したデータはレジストリ データベースには格納されません。このキーが記述されているレジストリにアクセスすると、適切なシステム オブジェクト マネージャからデータが収集されます。
ローカル システムからパフォーマンス データを取得するには、Registry.PerformanceData キーを指定した GetValue メソッドを使用します。最初の呼び出しでこのキーが開かれます。初めにキーを明示的に開く必要はありません。パフォーマンス データの取得が完了したら、必ず Close メソッドを使用してこのキーへのハンドルを閉じてください。パフォーマンス データが使用されている間は、ユーザーはソフトウェア コンポーネントをインストールまたは削除できません。
リモート システムからパフォーマンス データを取得するには、リモート システムのコンピュータ名と Registry.PerformanceData キーを指定した OpenRemoteBaseKey メソッドを使用する必要があります。このメソッドを呼び出すと、リモート システムのパフォーマンス データを表すキーが取得されます。データを取得するには、Registry.PerformanceData キーではなくこのキーを使用して GetValue を呼び出します。
![]() |
---|
Windows Server 2003 では、ユーザーがこの基本キーのサブキーにアクセスするには、少なくとも Performance Monitor Users グループに属している必要があります。 |
![使用例](http://weblio.hs.llnwd.net/e7/img/dict/msdnc/minus.gif)
このキーのサブキーを取得し、これらのサブキーの名前を画面に出力する方法の例を次に示します。必要な特定のサブキーのインスタンスを作成するには、OpenSubKey メソッドを使用します。次に、RegistryKey で別の演算を使用して、そのキーを操作します。パフォーマンス データがない場合があるため、この例では結果が返されないことがある点に注意してください。
Imports System 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
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; } } }
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 ); }
import System.*; import Microsoft.Win32.*; class Reg { public static void main(String[] args) { // 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); } //main 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.get_Name()); Console.WriteLine("-----------------------------------------------"); // Print the contents of the array to the console. String s = null; for (int iCtr = 0; iCtr < names.get_Length(); iCtr++) { s = names[iCtr]; 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; } } } //PrintKeys } //Reg
![プラットフォーム](http://weblio.hs.llnwd.net/e7/img/dict/msdnc/minus.gif)
Windows 2000 SP4, Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
![バージョン情報](http://weblio.hs.llnwd.net/e7/img/dict/msdnc/minus.gif)
![参照](http://weblio.hs.llnwd.net/e7/img/dict/msdnc/minus.gif)
- Registry.PerformanceData フィールドのページへのリンク