次の方法で共有


PerformanceCounter.CounterName プロパティ

この PerformanceCounter インスタンスに関連付けられているパフォーマンス カウンタ名を取得または設定します。

名前空間: System.Diagnostics
アセンブリ: System (system.dll 内)

構文

'宣言
Public Property CounterName As String
'使用
Dim instance As PerformanceCounter
Dim value As String

value = instance.CounterName

instance.CounterName = value
public string CounterName { get; set; }
public:
property String^ CounterName {
    String^ get ();
    void set (String^ value);
}
/** @property */
public String get_CounterName ()

/** @property */
public void set_CounterName (String value)
public function get CounterName () : String

public function set CounterName (value : String)

プロパティ値

カウンタ名は、通常、カウントする量を説明します。この名前は、パフォーマンス カウンタ マネージャ MMC スナップインの [カウンタの追加] ダイアログ ボックスのカウンタの一覧に表示されます。

例外

例外の種類 条件

ArgumentNullException

CounterName が null 参照 (Visual Basic では Nothing) です。

PlatformNotSupportedException

プラットフォームが Windows 98 または Windows Millennium Edition (Me) です。パフォーマンス カウンタはサポートされません。

使用例

Dim PC As New PerformanceCounter()
PC.CategoryName = "Process"
PC.CounterName = "Private Bytes"
PC.InstanceName = "Explorer"
MessageBox.Show(PC.NextValue().ToString())
PerformanceCounter PC=new PerformanceCounter();
PC.CategoryName="Process";
PC.CounterName="Private Bytes";
PC.InstanceName="Explorer";
MessageBox.Show(PC.NextValue().ToString());
PerformanceCounter^ PC = gcnew PerformanceCounter;
PC->CategoryName = "Process";
PC->CounterName = "Private Bytes";
PC->InstanceName = "Explorer";
MessageBox::Show( PC->NextValue().ToString() );
PerformanceCounter pc = new PerformanceCounter();
pc.set_CategoryName("Process");
pc.set_CounterName("Private Bytes");
pc.set_InstanceName("Explorer");
MessageBox.Show(((Single)pc.NextValue()).ToString());

プラットフォーム

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。

バージョン情報

.NET Framework

サポート対象 : 2.0、1.1、1.0

参照

関連項目

PerformanceCounter クラス
PerformanceCounter メンバ
System.Diagnostics 名前空間