PerformanceCounter.InstanceName 속성

정의

이 성능 카운터에 대한 인스턴스 이름을 가져오거나 설정합니다.

public:
 property System::String ^ InstanceName { System::String ^ get(); void set(System::String ^ value); };
public string InstanceName { get; set; }
[System.ComponentModel.TypeConverter("System.Diagnostics.Design.InstanceNameConverter, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public string InstanceName { get; set; }
[System.ComponentModel.TypeConverter("System.Diagnostics.Design.InstanceNameConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public string InstanceName { get; set; }
[System.ComponentModel.SettingsBindable(true)]
[System.ComponentModel.TypeConverter("System.Diagnostics.Design.InstanceNameConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public string InstanceName { get; set; }
member this.InstanceName : string with get, set
[<System.ComponentModel.TypeConverter("System.Diagnostics.Design.InstanceNameConverter, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
member this.InstanceName : string with get, set
[<System.ComponentModel.TypeConverter("System.Diagnostics.Design.InstanceNameConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
member this.InstanceName : string with get, set
[<System.ComponentModel.SettingsBindable(true)>]
[<System.ComponentModel.TypeConverter("System.Diagnostics.Design.InstanceNameConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
member this.InstanceName : string with get, set
Public Property InstanceName As String

속성 값

성능 카운터 범주 인스턴스의 이름이거나, 카운터가 단일 인스턴스 카운터인 경우 빈 문자열("") 입니다.

특성

예제

다음 코드 예제에서는 클래스의 PerformanceCounter 기본 instance 만듭니다. instance 만든 CategoryName후 , CounterNameInstanceName 속성 값이 설정되고 메서드에 NextValue 대한 호출 결과가 표시됩니다.

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

설명

참고

인스턴스 이름은 길이가 128자보다 짧아야 합니다.

경우에 따라 범주가 인스턴스로 세분화되어 범주가 관련된 개체의 여러 발생에 대한 데이터를 추적합니다. 인스턴스는 개별 카운터가 아닌 범주 전체에 적용됩니다. 범주 내의 모든 카운터에는 범주에 대해 정의된 각 instance 있습니다. 예를 들어 프로세스 범주에는 유휴 및 시스템이라는 인스턴스가 포함됩니다. 따라서 프로세스 범주 내의 모든 카운터에는 유휴 프로세스 또는 시스템 프로세스에 대한 정보를 표시하는 각 instance 대한 데이터가 포함됩니다.

많은 범주에는 여러 인스턴스가 포함되어 있지 않으므로 이 속성을 비워 두면 범주와 연결된 instance 없음을 나타낼 수 있습니다.

PerformanceCounter instance 비사용자 범주를 가리키는 경우 기존 범주 인스턴스 중에서만 선택할 수 있습니다. 사용자 지정 범주에서만 새 범주 인스턴스를 만들 수 있으므로 필요한 만큼 카운터 및 범주 인스턴스를 정의할 수 있습니다.

성능 범주 instance 만들려면 생성자에 를 instanceNamePerformanceCounter 지정합니다. 에 지정된 instanceName 범주 instance 이미 있는 경우 새 개체는 기존 범주 instance 참조합니다.

참고

instance 이름에 "(", ")", "#", "\" 또는 "/" 문자를 사용하지 마세요. 이러한 문자를 사용하는 경우 성능 콘솔(런타임 프로파일링 참조)이 instance 값을 올바르게 표시하지 못할 수 있습니다.

instance 이름이 자동으로 생성되고 "(", ")", "#", "\" 또는 "/" 문자가 포함될 수 있는 경우 다음 표의 문자 매핑을 사용합니다.

문자 매핑된 문자
( [
) ]
# _
\ _
/ _

FriendlyName 속성에서 AppDomain.CurrentDomain 가져온 개체의 AppDomain 속성은 잘못된 문자를 포함할 수 있는 instance 이름의 일반적인 소스입니다.

적용 대상