PerformanceCounterCategory.Create メソッド

定義

カスタム パフォーマンス カウンター カテゴリと 1 つ以上のカウンターをシステムに登録します。

オーバーロード

名前 説明
Create(String, String, String, String)
古い.
古い.
古い.

ローカル コンピューターで NumberOfItems32 型の 1 つのカウンターを含むカスタム パフォーマンス カウンター カテゴリを登録します。

Create(String, String, PerformanceCounterCategoryType, String, String)

ローカル コンピューターで NumberOfItems32 型の 1 つのカウンターを含むカスタム パフォーマンス カウンター カテゴリを登録します。

Create(String, String, CounterCreationDataCollection)
古い.
古い.
古い.

ローカル コンピューター上の指定したカウンターを含むカスタム パフォーマンス カウンター カテゴリを登録します。

Create(String, String, PerformanceCounterCategoryType, CounterCreationDataCollection)

ローカル コンピューター上の指定したカウンターを含むカスタム パフォーマンス カウンター カテゴリを登録します。

Create(String, String, String, String)

ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs

注意事項

This overload of PerformanceCounterCategory.Create has been deprecated. Use System.Diagnostics.PerformanceCounterCategory.Create(string categoryName, string categoryHelp, PerformanceCounterCategoryType categoryType, string counterName, string counterHelp) instead.

注意事項

This method has been deprecated. Please use System.Diagnostics.PerformanceCounterCategory.Create(string categoryName, string categoryHelp, PerformanceCounterCategoryType categoryType, string counterName, string counterHelp) instead. http://go.microsoft.com/fwlink/?linkid=14202

注意事項

This method has been deprecated. Please use System.Diagnostics.PerformanceCounterCategory.Create(string categoryName, string categoryHelp, PerformanceCounterCategoryType categoryType, string counterName, string counterHelp) instead. https://go.microsoft.com/fwlink/?linkid=14202

ローカル コンピューターで NumberOfItems32 型の 1 つのカウンターを含むカスタム パフォーマンス カウンター カテゴリを登録します。

public:
 static System::Diagnostics::PerformanceCounterCategory ^ Create(System::String ^ categoryName, System::String ^ categoryHelp, System::String ^ counterName, System::String ^ counterHelp);
[System.Obsolete("This overload of PerformanceCounterCategory.Create has been deprecated. Use System.Diagnostics.PerformanceCounterCategory.Create(string categoryName, string categoryHelp, PerformanceCounterCategoryType categoryType, string counterName, string counterHelp) instead.")]
public static System.Diagnostics.PerformanceCounterCategory Create(string categoryName, string categoryHelp, string counterName, string counterHelp);
public static System.Diagnostics.PerformanceCounterCategory Create(string categoryName, string categoryHelp, string counterName, string counterHelp);
[System.Obsolete("This method has been deprecated.  Please use System.Diagnostics.PerformanceCounterCategory.Create(string categoryName, string categoryHelp, PerformanceCounterCategoryType categoryType, string counterName, string counterHelp) instead.  http://go.microsoft.com/fwlink/?linkid=14202")]
public static System.Diagnostics.PerformanceCounterCategory Create(string categoryName, string categoryHelp, string counterName, string counterHelp);
[System.Obsolete("This method has been deprecated.  Please use System.Diagnostics.PerformanceCounterCategory.Create(string categoryName, string categoryHelp, PerformanceCounterCategoryType categoryType, string counterName, string counterHelp) instead.  https://go.microsoft.com/fwlink/?linkid=14202")]
public static System.Diagnostics.PerformanceCounterCategory Create(string categoryName, string categoryHelp, string counterName, string counterHelp);
[<System.Obsolete("This overload of PerformanceCounterCategory.Create has been deprecated. Use System.Diagnostics.PerformanceCounterCategory.Create(string categoryName, string categoryHelp, PerformanceCounterCategoryType categoryType, string counterName, string counterHelp) instead.")>]
static member Create : string * string * string * string -> System.Diagnostics.PerformanceCounterCategory
static member Create : string * string * string * string -> System.Diagnostics.PerformanceCounterCategory
[<System.Obsolete("This method has been deprecated.  Please use System.Diagnostics.PerformanceCounterCategory.Create(string categoryName, string categoryHelp, PerformanceCounterCategoryType categoryType, string counterName, string counterHelp) instead.  http://go.microsoft.com/fwlink/?linkid=14202")>]
static member Create : string * string * string * string -> System.Diagnostics.PerformanceCounterCategory
[<System.Obsolete("This method has been deprecated.  Please use System.Diagnostics.PerformanceCounterCategory.Create(string categoryName, string categoryHelp, PerformanceCounterCategoryType categoryType, string counterName, string counterHelp) instead.  https://go.microsoft.com/fwlink/?linkid=14202")>]
static member Create : string * string * string * string -> System.Diagnostics.PerformanceCounterCategory
Public Shared Function Create (categoryName As String, categoryHelp As String, counterName As String, counterHelp As String) As PerformanceCounterCategory

パラメーター

categoryName
String

システムに作成して登録するカスタム パフォーマンス カウンター カテゴリの名前。

categoryHelp
String

カスタム カテゴリの説明。

counterName
String

新しいカテゴリの一部として作成する NumberOfItems32型の新しいカウンターの名前。

counterHelp
String

新しいカスタム カテゴリに関連付けられているカウンターの説明。

返品

新しいシステム カテゴリまたはパフォーマンス オブジェクトに関連付けられている PerformanceCounterCategory

属性

例外

counterNamenull または空の文字列 ("") です。

-又は-

counterNameによって指定されたカウンターは既に存在します。

-又は-

counterName には無効な構文があります。 円記号 ("\") または長さが 80 文字を超える場合があります。

カテゴリは、ローカル コンピューターに既に存在します。

categoryNamenullです。

-又は-

counterHelpnullです。

基になるシステム API の呼び出しに失敗しました。

管理特権なしで実行されているコードが、パフォーマンス カウンターを読み取ろうとしました。

注釈

Note

Windows Vista 以降、Windows XP Professional x64 Edition、または Windows Server 2003 の非対話型ログオン セッションからパフォーマンス カウンターを読み取る場合は、パフォーマンス モニター ユーザー グループのメンバーであるか、管理者特権を持っている必要があります。

Windows Vista 以降のパフォーマンス カウンターにアクセスするために特権を昇格する必要を回避するには、パフォーマンス モニター ユーザー グループに自分自身を追加します。

Windows Vista 以降では、ユーザー アカウント制御 (UAC) によってユーザーの権限が決定されます。 組み込みの Administrators グループのメンバーである場合は、標準ユーザー アクセス トークンと管理者アクセス トークンという 2 つのランタイム アクセス トークンが割り当てられます。 既定では、標準のユーザー ロールになります。 パフォーマンス カウンターにアクセスするコードを実行するには、まず特権を標準ユーザーから管理者に昇格させる必要があります。 これを行うには、アプリケーション アイコンを右クリックし、管理者として実行することを示すことで、アプリケーションを起動します。

こちらもご覧ください

適用対象

Create(String, String, PerformanceCounterCategoryType, String, String)

ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs

ローカル コンピューターで NumberOfItems32 型の 1 つのカウンターを含むカスタム パフォーマンス カウンター カテゴリを登録します。

public:
 static System::Diagnostics::PerformanceCounterCategory ^ Create(System::String ^ categoryName, System::String ^ categoryHelp, System::Diagnostics::PerformanceCounterCategoryType categoryType, System::String ^ counterName, System::String ^ counterHelp);
public static System.Diagnostics.PerformanceCounterCategory Create(string categoryName, string categoryHelp, System.Diagnostics.PerformanceCounterCategoryType categoryType, string counterName, string counterHelp);
static member Create : string * string * System.Diagnostics.PerformanceCounterCategoryType * string * string -> System.Diagnostics.PerformanceCounterCategory
Public Shared Function Create (categoryName As String, categoryHelp As String, categoryType As PerformanceCounterCategoryType, counterName As String, counterHelp As String) As PerformanceCounterCategory

パラメーター

categoryName
String

システムに作成して登録するカスタム パフォーマンス カウンター カテゴリの名前。

categoryHelp
String

カスタム カテゴリの説明。

categoryType
PerformanceCounterCategoryType

カテゴリがPerformanceCounterCategoryTypeMultiInstance、またはSingleInstanceかどうかを指定するUnknown値の 1 つ。

counterName
String

新しいカテゴリの一部として作成する新しいカウンターの名前。

counterHelp
String

新しいカスタム カテゴリに関連付けられているカウンターの説明。

返品

新しいシステム カテゴリまたはパフォーマンス オブジェクトに関連付けられている PerformanceCounterCategory

例外

counterNamenull または空の文字列 ("") です。

-又は-

counterNameによって指定されたカウンターは既に存在します。

-又は-

counterName には無効な構文があります。 円記号 ("\") または長さが 80 文字を超える場合があります。

カテゴリは、ローカル コンピューターに既に存在します。

categoryNamenullです。

-又は-

counterHelpnullです。

基になるシステム API の呼び出しに失敗しました。

管理特権なしで実行されているコードが、パフォーマンス カウンターを読み取ろうとしました。

次のコード例は、 Create メソッドの使用方法を示しています。 この例では、カスタムの単一インスタンス パフォーマンス カウンター カテゴリを作成する方法を示します。

Console.WriteLine("Creating Inventory custom counter");
if (!PerformanceCounterCategory.Exists("Inventory"))
    PerformanceCounterCategory.Create("Inventory",
        "Truck inventory",
        PerformanceCounterCategoryType.SingleInstance,
        "Trucks", "Number of trucks on hand");
Console.WriteLine("Creating Inventory custom counter")
If Not PerformanceCounterCategory.Exists("Inventory") Then
    PerformanceCounterCategory.Create("Inventory", "Truck inventory", PerformanceCounterCategoryType.SingleInstance, "Trucks", "Number of trucks on hand")
End If

注釈

categoryType パラメーターは、パフォーマンス カウンター カテゴリが単一インスタンスか複数インスタンスかを指定します。 既定では、カテゴリは作成時に単一インスタンスになり、別のインスタンスが追加されるとマルチインスタンスになります。 カテゴリは、アプリケーションのセットアップ時に作成され、インスタンスは実行時に追加されます。 PerformanceCounterCategoryType列挙は、パフォーマンス カウンターに複数のインスタンスを含めることができるかどうかを示すために使用されます。

.NETインストールされたパフォーマンス カウンター カテゴリでは、個別の共有メモリが使用され、各パフォーマンス カウンター カテゴリには独自のメモリが割り当てられます。 個別の共有メモリのサイズを指定するには、レジストリ キーに FileMappingSize という名前の DWORD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<>\Performance を作成します。 FileMappingSize 値は、カテゴリの共有メモリ サイズに設定されます。 既定のサイズは 10 進数131072です。 FileMappingSize 値が存在しない場合は、Machine.config ファイルで指定されたfileMappingSize要素のperformanceCounters属性値が使用され、構成ファイルの処理に追加のオーバーヘッドが発生します。 レジストリでファイル マッピング サイズを設定することで、アプリケーションの起動のパフォーマンスを向上させることができます。

Note

アプリケーションの実行中ではなく、アプリケーションのインストール時に新しいパフォーマンス カウンター カテゴリを作成することを強くお勧めします。 これにより、オペレーティング システムが登録されているパフォーマンス カウンター カテゴリの一覧を更新する時間が得られます。 リストが更新されていない場合、カテゴリの使用は失敗します。

Note

Windows Vista 以降、Windows XP Professional x64 Edition、または Windows Server 2003 の非対話型ログオン セッションからパフォーマンス カウンターを読み取る場合は、パフォーマンス モニター ユーザー グループのメンバーであるか、管理者特権を持っている必要があります。

Windows Vista 以降のパフォーマンス カウンターにアクセスするために特権を昇格する必要を回避するには、パフォーマンス モニター ユーザー グループに自分自身を追加します。

Windows Vista 以降では、ユーザー アカウント制御 (UAC) によってユーザーの権限が決定されます。 組み込みの Administrators グループのメンバーである場合は、標準ユーザー アクセス トークンと管理者アクセス トークンという 2 つのランタイム アクセス トークンが割り当てられます。 既定では、標準のユーザー ロールになります。 パフォーマンス カウンターにアクセスするコードを実行するには、まず特権を標準ユーザーから管理者に昇格させる必要があります。 これを行うには、アプリケーション アイコンを右クリックし、管理者として実行することを示すことで、アプリケーションを起動します。

こちらもご覧ください

適用対象

Create(String, String, CounterCreationDataCollection)

ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs

注意事項

This overload of PerformanceCounterCategory.Create has been deprecated. Use System.Diagnostics.PerformanceCounterCategory.Create(string categoryName, string categoryHelp, PerformanceCounterCategoryType categoryType, CounterCreationDataCollection counterData) instead.

注意事項

This method has been deprecated. Please use System.Diagnostics.PerformanceCounterCategory.Create(string categoryName, string categoryHelp, PerformanceCounterCategoryType categoryType, CounterCreationDataCollection counterData) instead. http://go.microsoft.com/fwlink/?linkid=14202

注意事項

This method has been deprecated. Please use System.Diagnostics.PerformanceCounterCategory.Create(string categoryName, string categoryHelp, PerformanceCounterCategoryType categoryType, CounterCreationDataCollection counterData) instead. https://go.microsoft.com/fwlink/?linkid=14202

ローカル コンピューター上の指定したカウンターを含むカスタム パフォーマンス カウンター カテゴリを登録します。

public:
 static System::Diagnostics::PerformanceCounterCategory ^ Create(System::String ^ categoryName, System::String ^ categoryHelp, System::Diagnostics::CounterCreationDataCollection ^ counterData);
[System.Obsolete("This overload of PerformanceCounterCategory.Create has been deprecated. Use System.Diagnostics.PerformanceCounterCategory.Create(string categoryName, string categoryHelp, PerformanceCounterCategoryType categoryType, CounterCreationDataCollection counterData) instead.")]
public static System.Diagnostics.PerformanceCounterCategory Create(string categoryName, string categoryHelp, System.Diagnostics.CounterCreationDataCollection counterData);
public static System.Diagnostics.PerformanceCounterCategory Create(string categoryName, string categoryHelp, System.Diagnostics.CounterCreationDataCollection counterData);
[System.Obsolete("This method has been deprecated.  Please use System.Diagnostics.PerformanceCounterCategory.Create(string categoryName, string categoryHelp, PerformanceCounterCategoryType categoryType, CounterCreationDataCollection counterData) instead.  http://go.microsoft.com/fwlink/?linkid=14202")]
public static System.Diagnostics.PerformanceCounterCategory Create(string categoryName, string categoryHelp, System.Diagnostics.CounterCreationDataCollection counterData);
[System.Obsolete("This method has been deprecated.  Please use System.Diagnostics.PerformanceCounterCategory.Create(string categoryName, string categoryHelp, PerformanceCounterCategoryType categoryType, CounterCreationDataCollection counterData) instead.  https://go.microsoft.com/fwlink/?linkid=14202")]
public static System.Diagnostics.PerformanceCounterCategory Create(string categoryName, string categoryHelp, System.Diagnostics.CounterCreationDataCollection counterData);
[<System.Obsolete("This overload of PerformanceCounterCategory.Create has been deprecated. Use System.Diagnostics.PerformanceCounterCategory.Create(string categoryName, string categoryHelp, PerformanceCounterCategoryType categoryType, CounterCreationDataCollection counterData) instead.")>]
static member Create : string * string * System.Diagnostics.CounterCreationDataCollection -> System.Diagnostics.PerformanceCounterCategory
static member Create : string * string * System.Diagnostics.CounterCreationDataCollection -> System.Diagnostics.PerformanceCounterCategory
[<System.Obsolete("This method has been deprecated.  Please use System.Diagnostics.PerformanceCounterCategory.Create(string categoryName, string categoryHelp, PerformanceCounterCategoryType categoryType, CounterCreationDataCollection counterData) instead.  http://go.microsoft.com/fwlink/?linkid=14202")>]
static member Create : string * string * System.Diagnostics.CounterCreationDataCollection -> System.Diagnostics.PerformanceCounterCategory
[<System.Obsolete("This method has been deprecated.  Please use System.Diagnostics.PerformanceCounterCategory.Create(string categoryName, string categoryHelp, PerformanceCounterCategoryType categoryType, CounterCreationDataCollection counterData) instead.  https://go.microsoft.com/fwlink/?linkid=14202")>]
static member Create : string * string * System.Diagnostics.CounterCreationDataCollection -> System.Diagnostics.PerformanceCounterCategory
Public Shared Function Create (categoryName As String, categoryHelp As String, counterData As CounterCreationDataCollection) As PerformanceCounterCategory

パラメーター

categoryName
String

システムに作成して登録するカスタム パフォーマンス カウンター カテゴリの名前。

categoryHelp
String

カスタム カテゴリの説明。

counterData
CounterCreationDataCollection

新しいカテゴリの一部として作成するカウンターを指定する CounterCreationDataCollection

返品

新しいカスタム カテゴリまたはパフォーマンス オブジェクトに関連付けられている PerformanceCounterCategory

属性

例外

counterData コレクション内で指定されたカウンター名がnullまたは空の文字列 ("") です。

-又は-

counterData コレクション内に指定されたカウンターが既に存在します。

categoryName パラメーターはnull

カテゴリは、ローカル コンピューターに既に存在します。

-又は-

ベース カウンターの counterData コレクションのレイアウトが正しくありません。 AverageCount64AverageTimer32CounterMultiTimerCounterMultiTimerInverseCounterMultiTimer100NsCounterMultiTimer100NsInverseRawFractionSampleFraction、またはSampleCounterのカウンターの直後に、いずれかの基本カウンターの種類 (AverageBaseMultiBaseRawBase、またはSampleBase) が続く必要があります。

基になるシステム API の呼び出しに失敗しました。

管理特権なしで実行されているコードが、パフォーマンス カウンターを読み取ろうとしました。

注釈

Note

Windows Vista 以降、Windows XP Professional x64 Edition、または Windows Server 2003 の非対話型ログオン セッションからパフォーマンス カウンターを読み取る場合は、パフォーマンス モニター ユーザー グループのメンバーであるか、管理者特権を持っている必要があります。

Windows Vista 以降のパフォーマンス カウンターにアクセスするために特権を昇格する必要を回避するには、パフォーマンス モニター ユーザー グループに自分自身を追加します。

Windows Vista 以降では、ユーザー アカウント制御 (UAC) によってユーザーの権限が決定されます。 組み込みの Administrators グループのメンバーである場合は、標準ユーザー アクセス トークンと管理者アクセス トークンという 2 つのランタイム アクセス トークンが割り当てられます。 既定では、標準のユーザー ロールになります。 パフォーマンス カウンターにアクセスするコードを実行するには、まず特権を標準ユーザーから管理者に昇格させる必要があります。 これを行うには、アプリケーション アイコンを右クリックし、管理者として実行することを示すことで、アプリケーションを起動します。

こちらもご覧ください

適用対象

Create(String, String, PerformanceCounterCategoryType, CounterCreationDataCollection)

ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs
ソース:
PerformanceCounterCategory.cs

ローカル コンピューター上の指定したカウンターを含むカスタム パフォーマンス カウンター カテゴリを登録します。

public:
 static System::Diagnostics::PerformanceCounterCategory ^ Create(System::String ^ categoryName, System::String ^ categoryHelp, System::Diagnostics::PerformanceCounterCategoryType categoryType, System::Diagnostics::CounterCreationDataCollection ^ counterData);
public static System.Diagnostics.PerformanceCounterCategory Create(string categoryName, string categoryHelp, System.Diagnostics.PerformanceCounterCategoryType categoryType, System.Diagnostics.CounterCreationDataCollection counterData);
static member Create : string * string * System.Diagnostics.PerformanceCounterCategoryType * System.Diagnostics.CounterCreationDataCollection -> System.Diagnostics.PerformanceCounterCategory
Public Shared Function Create (categoryName As String, categoryHelp As String, categoryType As PerformanceCounterCategoryType, counterData As CounterCreationDataCollection) As PerformanceCounterCategory

パラメーター

categoryName
String

システムに作成して登録するカスタム パフォーマンス カウンター カテゴリの名前。

categoryHelp
String

カスタム カテゴリの説明。

counterData
CounterCreationDataCollection

新しいカテゴリの一部として作成するカウンターを指定する CounterCreationDataCollection

返品

新しいカスタム カテゴリまたはパフォーマンス オブジェクトに関連付けられている PerformanceCounterCategory

例外

counterData コレクション内で指定されたカウンター名がnullまたは空の文字列 ("") です。

-又は-

counterData コレクション内に指定されたカウンターが既に存在します。

categoryNamenullです。

-又は-

counterDatanullです。

categoryType 値が次の値の範囲外です: MultiInstanceSingleInstance、または Unknown

カテゴリは、ローカル コンピューターに既に存在します。

-又は-

ベース カウンターの counterData コレクションのレイアウトが正しくありません。 AverageCount64AverageTimer32CounterMultiTimerCounterMultiTimerInverseCounterMultiTimer100NsCounterMultiTimer100NsInverseRawFractionSampleFraction、またはSampleCounterのカウンターの直後に、いずれかの基本カウンターの種類 (AverageBaseMultiBaseRawBase、またはSampleBase) が続く必要があります。

基になるシステム API の呼び出しに失敗しました。

管理特権なしで実行されているコードが、パフォーマンス カウンターを読み取ろうとしました。

次のコード例は、 Create メソッドの使用方法を示しています。 この例では、1 秒あたりの注文数に対してカスタムのマルチインスタンス パフォーマンス カウンター カテゴリを作成する方法を示します。

CounterCreationData data1 = new CounterCreationData("Trucks",
    "Number of orders", PerformanceCounterType.NumberOfItems32);
CounterCreationData data2 = new CounterCreationData("Rate of sales",
    "Orders/second", PerformanceCounterType.RateOfCountsPerSecond32);
CounterCreationDataCollection ccds = new CounterCreationDataCollection();
ccds.Add(data1);
ccds.Add(data2);
Console.WriteLine("Creating Orders custom counter.");
if (!PerformanceCounterCategory.Exists("Orders"))
    PerformanceCounterCategory.Create("Orders",
        "Processed orders",
        PerformanceCounterCategoryType.MultiInstance,
        ccds);
Dim data1 As New CounterCreationData("Trucks", "Number of orders", PerformanceCounterType.NumberOfItems32)
Dim data2 As New CounterCreationData("Rate of sales", "Orders/second", PerformanceCounterType.RateOfCountsPerSecond32)
Dim ccds As New CounterCreationDataCollection()
ccds.Add(data1)
ccds.Add(data2)
Console.WriteLine("Creating Orders custom counter.")
If Not PerformanceCounterCategory.Exists("Orders") Then
    PerformanceCounterCategory.Create("Orders", "Processed orders", PerformanceCounterCategoryType.MultiInstance, ccds)
End If

注釈

categoryType パラメーターは、パフォーマンス カウンター カテゴリが単一インスタンスか複数インスタンスかを指定します。 既定では、カテゴリは作成時に単一インスタンスになり、別のインスタンスが追加されるとマルチインスタンスになります。 カテゴリは、アプリケーションのセットアップ時に作成され、インスタンスは実行時に追加されます。 PerformanceCounterCategoryType列挙は、パフォーマンス カウンターに複数のインスタンスを含めることができるかどうかを示すために使用されます。

.NETインストールされたパフォーマンス カウンター カテゴリでは、個別の共有メモリが使用され、各パフォーマンス カウンター カテゴリには独自のメモリが割り当てられます。 個別の共有メモリのサイズを指定するには、レジストリ キーに FileMappingSize という名前の DWORD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<>\Performance を作成します。 FileMappingSize 値は、カテゴリの共有メモリ サイズに設定されます。 既定のサイズは 10 進数131072です。 FileMappingSize 値が存在しない場合は、Machine.config ファイルで指定されたfileMappingSize要素のperformanceCounters属性値が使用され、構成ファイルの処理に追加のオーバーヘッドが発生します。 レジストリでファイル マッピング サイズを設定することで、アプリケーションの起動のパフォーマンスを向上させることができます。

Note

アプリケーションの実行中ではなく、アプリケーションのインストール時に新しいパフォーマンス カウンター カテゴリを作成することを強くお勧めします。 これにより、オペレーティング システムが登録されているパフォーマンス カウンター カテゴリの一覧を更新する時間が得られます。 リストが更新されていない場合、カテゴリの使用は失敗します。

Note

Windows Vista 以降、Windows XP Professional x64 Edition、または Windows Server 2003 の非対話型ログオン セッションからパフォーマンス カウンターを読み取る場合は、パフォーマンス モニター ユーザー グループのメンバーであるか、管理者特権を持っている必要があります。

Windows Vista 以降のパフォーマンス カウンターにアクセスするために特権を昇格する必要を回避するには、パフォーマンス モニター ユーザー グループに自分自身を追加します。

Windows Vista 以降では、ユーザー アカウント制御 (UAC) によってユーザーの権限が決定されます。 組み込みの Administrators グループのメンバーである場合は、標準ユーザー アクセス トークンと管理者アクセス トークンという 2 つのランタイム アクセス トークンが割り当てられます。 既定では、標準のユーザー ロールになります。 パフォーマンス カウンターにアクセスするコードを実行するには、まず特権を標準ユーザーから管理者に昇格させる必要があります。 これを行うには、アプリケーション アイコンを右クリックし、管理者として実行することを示すことで、アプリケーションを起動します。

こちらもご覧ください

適用対象