PerformanceCounter 클래스

정의

Windows NT 성능 카운터 구성 요소를 나타냅니다.

public ref class PerformanceCounter sealed : System::ComponentModel::Component, System::ComponentModel::ISupportInitialize
public sealed class PerformanceCounter : System.ComponentModel.Component, System.ComponentModel.ISupportInitialize
type PerformanceCounter = class
    inherit Component
    interface ISupportInitialize
Public NotInheritable Class PerformanceCounter
Inherits Component
Implements ISupportInitialize
상속
PerformanceCounter
구현

예제

다음 코드 예제에서는 클래스를 사용하여 PerformanceCounter 카운터 형식을 만들고 사용하는 방법을 AverageCount64 보여 줍니다. 이 예제에서는 범주를 만들고, 카운터를 설정하고, 카운터에서 데이터를 수집하고, 클래스를 CounterSampleCalculator 호출하여 성능 카운터 데이터를 해석합니다. 중간 및 최종 결과가 콘솔 창에 표시됩니다. 다른 성능 카운터 유형의 추가 예제는 열거형을 PerformanceCounterType 참조하세요.

#using <System.dll>

using namespace System;
using namespace System::Collections;
using namespace System::Collections::Specialized;
using namespace System::Diagnostics;

// Output information about the counter sample.
void OutputSample( CounterSample s )
{
   Console::WriteLine( "\r\n+++++++++++" );
   Console::WriteLine( "Sample values - \r\n" );
   Console::WriteLine( "   BaseValue        = {0}", s.BaseValue );
   Console::WriteLine( "   CounterFrequency = {0}", s.CounterFrequency );
   Console::WriteLine( "   CounterTimeStamp = {0}", s.CounterTimeStamp );
   Console::WriteLine( "   CounterType      = {0}", s.CounterType );
   Console::WriteLine( "   RawValue         = {0}", s.RawValue );
   Console::WriteLine( "   SystemFrequency  = {0}", s.SystemFrequency );
   Console::WriteLine( "   TimeStamp        = {0}", s.TimeStamp );
   Console::WriteLine( "   TimeStamp100nSec = {0}", s.TimeStamp100nSec );
   Console::WriteLine( "++++++++++++++++++++++" );
}

//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++
//    Description - This counter type shows how many items are processed, on average,
//        during an operation. Counters of this type display a ratio of the items 
//        processed (such as bytes sent) to the number of operations completed. The  
//        ratio is calculated by comparing the number of items processed during the 
//        last interval to the number of operations completed during the last interval. 
// Generic type - Average
//      Formula - (N1 - N0) / (D1 - D0), where the numerator (N) represents the number 
//        of items processed during the last sample interval and the denominator (D) 
//        represents the number of operations completed during the last two sample 
//        intervals. 
//    Average (Nx - N0) / (Dx - D0)  
//    Example PhysicalDisk\ Avg. Disk Bytes/Transfer 
//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++
float MyComputeCounterValue( CounterSample s0, CounterSample s1 )
{
   float numerator = (float)s1.RawValue - (float)s0.RawValue;
   float denomenator = (float)s1.BaseValue - (float)s0.BaseValue;
   float counterValue = numerator / denomenator;
   return counterValue;
}

bool SetupCategory()
{
   if (  !PerformanceCounterCategory::Exists( "AverageCounter64SampleCategory" ) )
   {
      CounterCreationDataCollection^ CCDC = gcnew CounterCreationDataCollection;
      
      // Add the counter.
      CounterCreationData^ averageCount64 = gcnew CounterCreationData;
      averageCount64->CounterType = PerformanceCounterType::AverageCount64;
      averageCount64->CounterName = "AverageCounter64Sample";
      CCDC->Add( averageCount64 );
      
      // Add the base counter.
      CounterCreationData^ averageCount64Base = gcnew CounterCreationData;
      averageCount64Base->CounterType = PerformanceCounterType::AverageBase;
      averageCount64Base->CounterName = "AverageCounter64SampleBase";
      CCDC->Add( averageCount64Base );
      
      // Create the category.
      PerformanceCounterCategory::Create( "AverageCounter64SampleCategory", "Demonstrates usage of the AverageCounter64 performance counter type.", CCDC );
      return (true);
   }
   else
   {
      Console::WriteLine( "Category exists - AverageCounter64SampleCategory" );
      return (false);
   }
}

void CreateCounters( PerformanceCounter^% PC, PerformanceCounter^% BPC )
{
   
   // Create the counters.
   PC = gcnew PerformanceCounter( "AverageCounter64SampleCategory","AverageCounter64Sample",false );

   BPC = gcnew PerformanceCounter( "AverageCounter64SampleCategory","AverageCounter64SampleBase",false );
   PC->RawValue = 0;
   BPC->RawValue = 0;
}
void CollectSamples( ArrayList^ samplesList, PerformanceCounter^ PC, PerformanceCounter^ BPC )
{
   Random^ r = gcnew Random( DateTime::Now.Millisecond );

   // Loop for the samples.
   for ( int j = 0; j < 100; j++ )
   {
      int value = r->Next( 1, 10 );
      Console::Write( "{0} = {1}", j, value );
      PC->IncrementBy( value );
      BPC->Increment();
      if ( (j % 10) == 9 )
      {
         OutputSample( PC->NextSample() );
         samplesList->Add( PC->NextSample() );
      }
      else
            Console::WriteLine();
      System::Threading::Thread::Sleep( 50 );
   }
}

void CalculateResults( ArrayList^ samplesList )
{
   for ( int i = 0; i < (samplesList->Count - 1); i++ )
   {
      // Output the sample.
      OutputSample(  *safe_cast<CounterSample^>(samplesList[ i ]) );
      OutputSample(  *safe_cast<CounterSample^>(samplesList[ i + 1 ]) );
      
      // Use .NET to calculate the counter value.
      Console::WriteLine( ".NET computed counter value = {0}", CounterSampleCalculator::ComputeCounterValue(  *safe_cast<CounterSample^>(samplesList[ i ]),  *safe_cast<CounterSample^>(samplesList[ i + 1 ]) ) );
      
      // Calculate the counter value manually.
      Console::WriteLine( "My computed counter value = {0}", MyComputeCounterValue(  *safe_cast<CounterSample^>(samplesList[ i ]),  *safe_cast<CounterSample^>(samplesList[ i + 1 ]) ) );
   }
}

int main()
{
   ArrayList^ samplesList = gcnew ArrayList;
   PerformanceCounter^ PC;
   PerformanceCounter^ BPC;
   SetupCategory();
   CreateCounters( PC, BPC );
   CollectSamples( samplesList, PC, BPC );
   CalculateResults( samplesList );
}
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Diagnostics;

public class App
{
    private static PerformanceCounter avgCounter64Sample;
    private static PerformanceCounter avgCounter64SampleBase;

    public static void Main()
    {
        ArrayList samplesList = new ArrayList();

        // If the category does not exist, create the category and exit.
        // Performance counters should not be created and immediately used.
        // There is a latency time to enable the counters, they should be created
        // prior to executing the application that uses the counters.
        // Execute this sample a second time to use the category.
        if (SetupCategory())
            return;
        CreateCounters();
        CollectSamples(samplesList);
        CalculateResults(samplesList);
    }

    private static bool SetupCategory()
    {
        if ( !PerformanceCounterCategory.Exists("AverageCounter64SampleCategory") )
        {

            CounterCreationDataCollection counterDataCollection = new CounterCreationDataCollection();

            // Add the counter.
            CounterCreationData averageCount64 = new CounterCreationData();
            averageCount64.CounterType = PerformanceCounterType.AverageCount64;
            averageCount64.CounterName = "AverageCounter64Sample";
            counterDataCollection.Add(averageCount64);

            // Add the base counter.
            CounterCreationData averageCount64Base = new CounterCreationData();
            averageCount64Base.CounterType = PerformanceCounterType.AverageBase;
            averageCount64Base.CounterName = "AverageCounter64SampleBase";
            counterDataCollection.Add(averageCount64Base);

            // Create the category.
            PerformanceCounterCategory.Create("AverageCounter64SampleCategory",
                "Demonstrates usage of the AverageCounter64 performance counter type.",
                PerformanceCounterCategoryType.SingleInstance, counterDataCollection);

            return(true);
        }
        else
        {
            Console.WriteLine("Category exists - AverageCounter64SampleCategory");
            return(false);
        }
    }

    private static void CreateCounters()
    {
        // Create the counters.

        avgCounter64Sample = new PerformanceCounter("AverageCounter64SampleCategory",
            "AverageCounter64Sample",
            false);


        avgCounter64SampleBase = new PerformanceCounter("AverageCounter64SampleCategory",
            "AverageCounter64SampleBase",
            false);

        avgCounter64Sample.RawValue=0;
        avgCounter64SampleBase.RawValue=0;
    }
    private static void CollectSamples(ArrayList samplesList)
    {

        Random r = new Random( DateTime.Now.Millisecond );

        // Loop for the samples.
        for (int j = 0; j < 100; j++)
        {

            int value = r.Next(1, 10);
            Console.Write(j + " = " + value);

            avgCounter64Sample.IncrementBy(value);

            avgCounter64SampleBase.Increment();

            if ((j % 10) == 9)
            {
                OutputSample(avgCounter64Sample.NextSample());
                samplesList.Add( avgCounter64Sample.NextSample() );
            }
            else
            {
                Console.WriteLine();
            }

            System.Threading.Thread.Sleep(50);
        }
    }

    private static void CalculateResults(ArrayList samplesList)
    {
        for(int i = 0; i < (samplesList.Count - 1); i++)
        {
            // Output the sample.
            OutputSample( (CounterSample)samplesList[i] );
            OutputSample( (CounterSample)samplesList[i+1] );

            // Use .NET to calculate the counter value.
            Console.WriteLine(".NET computed counter value = " +
                CounterSampleCalculator.ComputeCounterValue((CounterSample)samplesList[i],
                (CounterSample)samplesList[i+1]) );

            // Calculate the counter value manually.
            Console.WriteLine("My computed counter value = " +
                MyComputeCounterValue((CounterSample)samplesList[i],
                (CounterSample)samplesList[i+1]) );
        }
    }

    //++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++
    //    Description - This counter type shows how many items are processed, on average,
    //        during an operation. Counters of this type display a ratio of the items
    //        processed (such as bytes sent) to the number of operations completed. The
    //        ratio is calculated by comparing the number of items processed during the
    //        last interval to the number of operations completed during the last interval.
    // Generic type - Average
    //      Formula - (N1 - N0) / (D1 - D0), where the numerator (N) represents the number
    //        of items processed during the last sample interval and the denominator (D)
    //        represents the number of operations completed during the last two sample
    //        intervals.
    //    Average (Nx - N0) / (Dx - D0)
    //    Example PhysicalDisk\ Avg. Disk Bytes/Transfer
    //++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++
    private static Single MyComputeCounterValue(CounterSample s0, CounterSample s1)
    {
        Single numerator = (Single)s1.RawValue - (Single)s0.RawValue;
        Single denomenator = (Single)s1.BaseValue - (Single)s0.BaseValue;
        Single counterValue = numerator / denomenator;
        return(counterValue);
    }

    // Output information about the counter sample.
    private static void OutputSample(CounterSample s)
    {
        Console.WriteLine("\r\n+++++++++++");
        Console.WriteLine("Sample values - \r\n");
        Console.WriteLine("   BaseValue        = " + s.BaseValue);
        Console.WriteLine("   CounterFrequency = " + s.CounterFrequency);
        Console.WriteLine("   CounterTimeStamp = " + s.CounterTimeStamp);
        Console.WriteLine("   CounterType      = " + s.CounterType);
        Console.WriteLine("   RawValue         = " + s.RawValue);
        Console.WriteLine("   SystemFrequency  = " + s.SystemFrequency);
        Console.WriteLine("   TimeStamp        = " + s.TimeStamp);
        Console.WriteLine("   TimeStamp100nSec = " + s.TimeStamp100nSec);
        Console.WriteLine("++++++++++++++++++++++");
    }
}
Imports System.Collections
Imports System.Collections.Specialized
Imports System.Diagnostics

 _

Public Class App

    Private Shared avgCounter64Sample As PerformanceCounter
    Private Shared avgCounter64SampleBase As PerformanceCounter


    Public Shared Sub Main()

        Dim samplesList As New ArrayList()
        'If the category does not exist, create the category and exit.
        'Performance counters should not be created and immediately used.
        'There is a latency time to enable the counters, they should be created
        'prior to executing the application that uses the counters.
        'Execute this sample a second time to use the counters.
        If Not (SetupCategory()) Then
            CreateCounters()
            CollectSamples(samplesList)
            CalculateResults(samplesList)
        End If

    End Sub

    Private Shared Function SetupCategory() As Boolean
        If Not PerformanceCounterCategory.Exists("AverageCounter64SampleCategory") Then

            Dim counterDataCollection As New CounterCreationDataCollection()

            ' Add the counter.
            Dim averageCount64 As New CounterCreationData()
            averageCount64.CounterType = PerformanceCounterType.AverageCount64
            averageCount64.CounterName = "AverageCounter64Sample"
            counterDataCollection.Add(averageCount64)

            ' Add the base counter.
            Dim averageCount64Base As New CounterCreationData()
            averageCount64Base.CounterType = PerformanceCounterType.AverageBase
            averageCount64Base.CounterName = "AverageCounter64SampleBase"
            counterDataCollection.Add(averageCount64Base)

            ' Create the category.
            PerformanceCounterCategory.Create("AverageCounter64SampleCategory", _
               "Demonstrates usage of the AverageCounter64 performance counter type.", _
                      PerformanceCounterCategoryType.SingleInstance, counterDataCollection)

            Return True
        Else
            Console.WriteLine("Category exists - AverageCounter64SampleCategory")
            Return False
        End If
    End Function 'SetupCategory

    Private Shared Sub CreateCounters()
        ' Create the counters.

        avgCounter64Sample = New PerformanceCounter("AverageCounter64SampleCategory", "AverageCounter64Sample", False)

        avgCounter64SampleBase = New PerformanceCounter("AverageCounter64SampleCategory", "AverageCounter64SampleBase", False)

        avgCounter64Sample.RawValue = 0
        avgCounter64SampleBase.RawValue = 0
    End Sub

    Private Shared Sub CollectSamples(ByVal samplesList As ArrayList)

        Dim r As New Random(DateTime.Now.Millisecond)

        ' Loop for the samples.
        Dim j As Integer
        For j = 0 To 99

            Dim value As Integer = r.Next(1, 10)
            Console.Write(j.ToString() + " = " + value.ToString())

            avgCounter64Sample.IncrementBy(value)

            avgCounter64SampleBase.Increment()

            If j Mod 10 = 9 Then
                OutputSample(avgCounter64Sample.NextSample())
                samplesList.Add(avgCounter64Sample.NextSample())
            Else
                Console.WriteLine()
            End If
            System.Threading.Thread.Sleep(50)
        Next j
    End Sub

    Private Shared Sub CalculateResults(ByVal samplesList As ArrayList)
        Dim i As Integer
        For i = 0 To (samplesList.Count - 1) - 1
            ' Output the sample.
            OutputSample(CType(samplesList(i), CounterSample))
            OutputSample(CType(samplesList((i + 1)), CounterSample))

            ' Use .NET to calculate the counter value.
            Console.WriteLine(".NET computed counter value = " + CounterSampleCalculator.ComputeCounterValue(CType(samplesList(i), CounterSample), CType(samplesList((i + 1)), CounterSample)).ToString())

            ' Calculate the counter value manually.
            Console.WriteLine("My computed counter value = " + MyComputeCounterValue(CType(samplesList(i), CounterSample), CType(samplesList((i + 1)), CounterSample)).ToString())
        Next i
    End Sub

    '++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++
    '	Description - This counter type shows how many items are processed, on average,
    '		during an operation. Counters of this type display a ratio of the items 
    '		processed (such as bytes sent) to the number of operations completed. The  
    '		ratio is calculated by comparing the number of items processed during the 
    '		last interval to the number of operations completed during the last interval. 
    ' Generic type - Average
    '  	Formula - (N1 - N0) / (D1 - D0), where the numerator (N) represents the number 
    '		of items processed during the last sample interval and the denominator (D) 
    '		represents the number of operations completed during the last two sample 
    '		intervals. 
    '	Average (Nx - N0) / (Dx - D0)  
    '	Example PhysicalDisk\ Avg. Disk Bytes/Transfer 
    '++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++
    Private Shared Function MyComputeCounterValue(ByVal s0 As CounterSample, ByVal s1 As CounterSample) As [Single]
        Dim numerator As [Single] = CType(s1.RawValue, [Single]) - CType(s0.RawValue, [Single])
        Dim denomenator As [Single] = CType(s1.BaseValue, [Single]) - CType(s0.BaseValue, [Single])
        Dim counterValue As [Single] = numerator / denomenator
        Return counterValue
    End Function 'MyComputeCounterValue

    ' Output information about the counter sample.
    Private Shared Sub OutputSample(ByVal s As CounterSample)
        Console.WriteLine(ControlChars.Lf + ControlChars.Cr + "+++++++++++")
        Console.WriteLine("Sample values - " + ControlChars.Lf + ControlChars.Cr)
        Console.WriteLine(("   BaseValue        = " + s.BaseValue.ToString()))
        Console.WriteLine(("   CounterFrequency = " + s.CounterFrequency.ToString()))
        Console.WriteLine(("   CounterTimeStamp = " + s.CounterTimeStamp.ToString()))
        Console.WriteLine(("   CounterType      = " + s.CounterType.ToString()))
        Console.WriteLine(("   RawValue         = " + s.RawValue.ToString()))
        Console.WriteLine(("   SystemFrequency  = " + s.SystemFrequency.ToString()))
        Console.WriteLine(("   TimeStamp        = " + s.TimeStamp.ToString()))
        Console.WriteLine(("   TimeStamp100nSec = " + s.TimeStamp100nSec.ToString()))
        Console.WriteLine("++++++++++++++++++++++")
    End Sub
End Class

설명

구성 PerformanceCounter 요소는 기존 미리 정의된 카운터 또는 사용자 지정 카운터를 읽고 성능 데이터를 사용자 지정 카운터에 게시(쓰기)하는 데 모두 사용할 수 있습니다.

Windows 성능 모니터 카운터 추가 대화 상자에는 미리 정의된 카운터가 많이 나열되어 있습니다. .NET Framework 성능 카운터에 대해 알아보려면 성능 카운터를 참조하세요.

이 형식이 구현 하는 IDisposable 인터페이스입니다. 형식을 사용 하 여 마쳤으면 직접 또는 간접적으로의 삭제 해야 있습니다. 직접 형식의 dispose 호출 해당 Dispose 의 메서드를 try/catch 블록입니다. 삭제 하지 직접, 언어 구문 같은 사용 using (C#에서) 또는 Using (Visual Basic에서는). 자세한 내용은 "를 사용 하는 개체는 구현 IDisposable" 섹션을 참조 하세요.를 IDisposable 인터페이스 항목입니다.

중요

.NET Framework 버전 1.0 및 1.1에서 이 클래스는 즉시 호출자를 완전히 신뢰해야 합니다. .NET Framework 버전 2.0부터 이 클래스는 PerformanceCounterPermission 특정 작업에 필요합니다. 반 신뢰할 수 있는 코드에는 부여하지 않는 것이 PerformanceCounterPermission 좋습니다. 성능 카운터를 읽고 쓰는 기능을 사용하면 코드가 실행 프로세스를 열거하고 이에 대한 정보를 가져오는 등의 작업을 수행할 수 있습니다.

또한 덜 신뢰할 수 있는 PerformanceCounter 코드에 개체를 전달하면 보안 문제가 발생할 수 있습니다. 또는 PerformanceCounter와 같은 성능 카운터 개체를 덜 신뢰할 수 있는 PerformanceCounterCategory 코드에 전달하지 마세요.

성능 카운터에서 읽으려면 클래스의 PerformanceCounter instance 만들고 , CounterName및 선택적으로 InstanceName 또는 MachineName 속성을 설정한 CategoryName다음 메서드를 호출 NextValue 하여 성능 카운터 읽기를 수행합니다.

성능 카운터 데이터를 게시하려면 메서드를 사용하여 PerformanceCounterCategory.Create 하나 이상의 사용자 지정 카운터를 만들고, 클래스의 PerformanceCounter instance 만들고, , CounterName 및, 선택적으로 InstanceName 또는 MachineName 속성을 설정한 CategoryName다음, , Increment또는 Decrement 메서드를 호출IncrementBy하거나 속성을 설정 RawValue 하여 사용자 지정 카운터의 값을 변경합니다.

참고

, IncrementByDecrement 메서드는 Increment인터록을 사용하여 카운터 값을 업데이트합니다. 이렇게 하면 다중 스레드 또는 다중 프로세서 시나리오에서 카운터 값을 정확하게 유지할 수 있지만 성능 저하도 발생합니다. 연동 작업이 제공하는 정확도가 필요하지 않은 경우 최대 5배 성능 향상을 위해 속성을 직접 업데이트 RawValue 할 수 있습니다. 그러나 다중 스레드 시나리오에서는 카운터 값에 대한 일부 업데이트가 무시되어 부정확한 데이터가 발생할 수 있습니다.

카운터는 성능 데이터가 수집되는 메커니즘입니다. 레지스트리는 시스템 기능의 특정 영역과 관련된 모든 카운터의 이름을 저장합니다. 예를 들어 프로세서의 사용량이 많은 시간, 메모리 사용량 또는 네트워크 연결을 통해 수신된 바이트 수가 있습니다.

각 카운터는 이름과 위치를 통해 고유하게 식별됩니다. 파일 경로에 드라이브, 디렉터리, 하나 이상의 하위 디렉터리 및 파일 이름이 포함된 것과 동일한 방식으로 카운터 정보는 컴퓨터, 범주, 범주 instance 및 카운터 이름의 네 가지 요소로 구성됩니다.

카운터 정보에는 카운터가 데이터를 측정하는 범주 또는 성능 개체가 포함되어야 합니다. 컴퓨터의 범주에는 프로세서, 디스크 및 메모리와 같은 물리적 구성 요소가 포함됩니다. 프로세스 및 스레드와 같은 시스템 범주도 있습니다. 각 범주는 컴퓨터 내의 기능 요소와 관련이 있으며 표준 카운터 집합이 할당되어 있습니다. 이러한 개체는 Windows 2000 시스템 모니터 내의 카운터 추가 대화 상자의 성능 개체 드롭다운 목록에 나열되며 카운터 경로에 포함해야 합니다. 성능 데이터는 관련된 범주별로 그룹화됩니다.

경우에 따라 동일한 범주의 여러 복사본이 있을 수 있습니다. 예를 들어 여러 프로세스와 스레드가 동시에 실행되고 일부 컴퓨터에는 둘 이상의 프로세서가 포함됩니다. 범주 복사본을 범주 인스턴스라고 하며 각 instance 할당된 표준 카운터 집합이 있습니다. 범주에 둘 이상의 instance 있을 수 있는 경우 카운터 정보에 instance 사양을 포함해야 합니다.

초기 또는 이전 값을 필요한 계산을 수행 하는 데 필요한 카운터에 대 한 성능 데이터를 가져오려면 호출을 NextValue 메서드를 두 번 및 사용 하 여 애플리케이션에 필요한 정보를 반환 합니다.

참고

.NET Framework 2.0과 함께 설치된 성능 카운터 범주는 별도의 공유 메모리를 사용하며 각 성능 카운터 범주에는 자체 메모리가 있습니다. 레지스트리 키 <HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\범주 이름>\성능에 FileMappingSize라는 DWORD를 만들어 별도의 공유 메모리 크기를 지정할 수 있습니다. FileMappingSize 값 범주의 공유 메모리 크기 설정 됩니다. 기본 크기는 10 진수 131072입니다. FileMappingSize 값 없는 경우는 fileMappingSize 특성에 대 한 값을 performanceCounters 합니다 Machine.config 파일에 지정 된 요소를 사용할 구성 파일을 처리에 대 한 추가 오버 헤드를 유발 합니다. 레지스트리에서 파일 매핑 크기를 설정 하 여 애플리케이션 시작에 대 한 성능 향상을 이룰 수 있습니다. 파일 매핑 크기에 대한 자세한 내용은 performanceCounters를 참조<하세요>.

생성자

PerformanceCounter()

PerformanceCounter 클래스의 새 읽기 전용 인스턴스를 초기화하면서 이 인스턴스를 시스템이나 사용자 지정 성능 카운터와 연결하지 않습니다.

PerformanceCounter(String, String)

PerformanceCounter 클래스의 새 읽기 전용 인스턴스를 초기화하고 로컬 컴퓨터의 지정 시스템이나 사용자 지정 성능 카운터에 연결합니다. 이 생성자를 사용하려면 범주에 단일 인스턴스가 있어야 합니다.

PerformanceCounter(String, String, Boolean)

PerformanceCounter 클래스의 새 읽기 전용 인스턴스 또는 읽기/쓰기 인스턴스를 초기화하여 로컬 컴퓨터의 지정 시스템이나 사용자 지정 성능 카운터에 연결합니다. 이 생성자를 사용하려면 범주에 단일 인스턴스가 있어야 합니다.

PerformanceCounter(String, String, String)

PerformanceCounter 클래스의 새 읽기 전용 인스턴스를 초기화하여 로컬 컴퓨터의 지정 시스템이나 사용자 지정 성능 카운터 및 범주 인스턴스에 연결합니다.

PerformanceCounter(String, String, String, Boolean)

PerformanceCounter 클래스의 새 읽기 전용 또는 읽기/쓰기 인스턴스를 초기화하여 로컬 컴퓨터의 지정 시스템이나 사용자 지정 성능 카운터 및 범주 인스턴스에 연결합니다.

PerformanceCounter(String, String, String, String)

PerformanceCounter 클래스의 새 읽기 전용 인스턴스를 초기화하여 특정 컴퓨터의 지정 시스템이나 사용자 지정 성능 카운터 및 범주 인스턴스에 연결합니다.

필드

DefaultFileMappingSize
사용되지 않음.
사용되지 않음.
사용되지 않음.

성능 카운터에서 공유하는 전역 메모리의 크기(바이트)를 지정합니다. 기본 크기는 524,288바이트입니다.

속성

CanRaiseEvents

구성 요소가 이벤트를 발생시킬 수 있는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 Component)
CategoryName

이 성능 카운터에 대한 성능 카운터 범주의 이름을 가져오거나 설정합니다.

Container

IContainer을 포함하는 Component를 가져옵니다.

(다음에서 상속됨 Component)
CounterHelp

이 성능 카운터에 대한 설명을 가져옵니다.

CounterName

PerformanceCounter 인스턴스와 연결된 성능 카운터의 이름을 가져오거나 설정합니다.

CounterType

관련된 성능 카운터의 카운터 형식을 가져옵니다.

DesignMode

Component가 현재 디자인 모드인지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 Component)
Events

Component에 연결된 이벤트 처리기의 목록을 가져옵니다.

(다음에서 상속됨 Component)
InstanceLifetime

프로세스의 수명을 가져오거나 설정합니다.

InstanceName

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

MachineName

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

RawValue

이 카운터의 원시 값 또는 계산되지 않은 값을 가져오거나 설정합니다.

ReadOnly

PerformanceCounter 인스턴스가 읽기 전용 모드에 있는지 여부를 나타내는 값을 가져오거나 설정합니다.

Site

ComponentISite를 가져오거나 설정합니다.

(다음에서 상속됨 Component)

메서드

BeginInit()

폼 또는 다른 구성 요소에서 사용하는 PerformanceCounter 인스턴스의 초기화를 시작합니다. 초기화는 런타임에 발생합니다.

Close()

성능 카운터를 닫고 이 성능 카운터 인스턴스가 할당한 모든 리소스를 해제합니다.

CloseSharedResources()

카운터에서 할당한 성능 카운터 라이브러리의 공유 상태를 해제합니다.

CreateObjRef(Type)

원격 개체와 통신하는 데 사용되는 프록시 생성에 필요한 모든 관련 정보가 들어 있는 개체를 만듭니다.

(다음에서 상속됨 MarshalByRefObject)
Decrement()

효율적인 원자 단위 연산을 통해 관련 성능 카운터를 1씩 감소시킵니다.

Dispose()

Component에서 사용하는 모든 리소스를 해제합니다.

(다음에서 상속됨 Component)
Dispose(Boolean)

Component에서 사용하는 관리되지 않는 리소스를 해제하고, 관리되는 리소스를 선택적으로 해제할 수 있습니다.

(다음에서 상속됨 Component)
EndInit()

폼 또는 다른 구성 요소에서 사용하는 PerformanceCounter 인스턴스의 초기화를 끝냅니다. 초기화는 런타임에 발생합니다.

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetLifetimeService()
사용되지 않음.

이 인스턴스의 수명 정책을 제어하는 현재의 수명 서비스 개체를 검색합니다.

(다음에서 상속됨 MarshalByRefObject)
GetService(Type)

Component 또는 해당 Container에서 제공하는 서비스를 나타내는 개체를 반환합니다.

(다음에서 상속됨 Component)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
Increment()

효율적인 원자 단위 연산을 통해 관련 성능 카운터를 1씩 증가시킵니다.

IncrementBy(Int64)

효율적인 원자 단위 연산을 통해 관련 성능 카운터의 값을 지정한 양 만큼 증가 또는 감소시킵니다.

InitializeLifetimeService()
사용되지 않음.

이 인스턴스의 수명 정책을 제어하는 수명 서비스 개체를 가져옵니다.

(다음에서 상속됨 MarshalByRefObject)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
MemberwiseClone(Boolean)

현재 MarshalByRefObject 개체의 단순 복사본을 만듭니다.

(다음에서 상속됨 MarshalByRefObject)
NextSample()

카운터 샘플을 가져와서 이에 대한 원시 값 또는 계산되지 않은 값을 반환합니다.

NextValue()

카운터 샘플을 가져와 계산된 값을 반환합니다.

RemoveInstance()

PerformanceCounter 개체의 InstanceName 속성에서 지정한 범주 인스턴스를 삭제합니다.

ToString()

Component의 이름이 포함된 String을 반환합니다(있는 경우). 이 메서드는 재정의할 수 없습니다.

(다음에서 상속됨 Component)

이벤트

Disposed

Dispose() 메서드를 호출하여 구성 요소를 삭제할 때 발생합니다.

(다음에서 상속됨 Component)

적용 대상

추가 정보