Process.WorkingSet 속성

정의

주의

This property has been deprecated. Please use System.Diagnostics.Process.WorkingSet64 instead. https://go.microsoft.com/fwlink/?linkid=14202

주의

Process.WorkingSet has been deprecated because the type of the property can't represent all valid results. Use System.Diagnostics.Process.WorkingSet64 instead.

주의

This property has been deprecated. Please use System.Diagnostics.Process.WorkingSet64 instead. http://go.microsoft.com/fwlink/?linkid=14202

연결된 프로세스의 실제 메모리 사용량(바이트)을 가져옵니다.

public:
 property int WorkingSet { int get(); };
[System.Obsolete("This property has been deprecated.  Please use System.Diagnostics.Process.WorkingSet64 instead.  https://go.microsoft.com/fwlink/?linkid=14202")]
public int WorkingSet { get; }
[System.Obsolete("Process.WorkingSet has been deprecated because the type of the property can't represent all valid results. Use System.Diagnostics.Process.WorkingSet64 instead.")]
public int WorkingSet { get; }
[System.Obsolete("This property has been deprecated.  Please use System.Diagnostics.Process.WorkingSet64 instead.  http://go.microsoft.com/fwlink/?linkid=14202")]
public int WorkingSet { get; }
public int WorkingSet { get; }
[<System.Obsolete("This property has been deprecated.  Please use System.Diagnostics.Process.WorkingSet64 instead.  https://go.microsoft.com/fwlink/?linkid=14202")>]
member this.WorkingSet : int
[<System.Obsolete("Process.WorkingSet has been deprecated because the type of the property can't represent all valid results. Use System.Diagnostics.Process.WorkingSet64 instead.")>]
member this.WorkingSet : int
[<System.Obsolete("This property has been deprecated.  Please use System.Diagnostics.Process.WorkingSet64 instead.  http://go.microsoft.com/fwlink/?linkid=14202")>]
member this.WorkingSet : int
member this.WorkingSet : int
Public ReadOnly Property WorkingSet As Integer

속성 값

연결된 프로세스에서 사용 중인 실제 메모리의 총 크기(바이트)입니다.

특성

예제

다음 예제에서는 메모장의 instance 시작합니다. 그런 다음, 이 예제에서는 연결된 프로세스의 다양한 속성을 검색하고 표시합니다. 이 예제에서는 프로세스가 종료되는 시기를 감지하고 프로세스의 종료 코드를 표시합니다.

#using <System.dll>

using namespace System;
using namespace System::Diagnostics;
using namespace System::Threading;
int main()
{
   try
   {
      Process^ myProcess;
      myProcess = Process::Start( "NotePad.exe" );
      while (  !myProcess->HasExited )
      {
         Console::WriteLine();
         
         // Get physical memory usage of the associated process.
         Console::WriteLine( "Process's physical memory usage: {0}", myProcess->WorkingSet.ToString() );
         
         // Get base priority of the associated process.
         Console::WriteLine( "Base priority of the associated process: {0}", myProcess->BasePriority.ToString() );
         
         // Get priority class of the associated process.
         Console::WriteLine(  "Priority class of the associated process: {0}", myProcess->PriorityClass );
         
         // Get user processor time for this process.
         Console::WriteLine( "User Processor Time: {0}", myProcess->UserProcessorTime.ToString() );
         
         // Get privileged processor time for this process.
         Console::WriteLine( "Privileged Processor Time: {0}", myProcess->PrivilegedProcessorTime.ToString() );
         
         // Get total processor time for this process.
         Console::WriteLine( "Total Processor Time: {0}", myProcess->TotalProcessorTime.ToString() );
         
         // Invoke overloaded ToString function.
         Console::WriteLine( "Process's Name: {0}", myProcess->ToString() );
         Console::WriteLine( "-------------------------------------" );
         if ( myProcess->Responding )
         {
            Console::WriteLine( "Status:  Responding to user interface" );
            myProcess->Refresh();
         }
         else
         {
            Console::WriteLine( "Status:  Not Responding" );
         }
         Thread::Sleep( 1000 );
      }
      Console::WriteLine();
      Console::WriteLine(  "Process exit code: {0}", myProcess->ExitCode.ToString() );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "The following exception was raised:  {0}", e->Message );
   }

}
using System;
using System.Diagnostics;
using System.Threading;

namespace ProcessSample
{
    class MyProcessClass
    {
        public static void Main()
        {
            try
            {
                using (Process myProcess = Process.Start("NotePad.exe"))
                {
                    while (!myProcess.HasExited)
                    {
                        Console.WriteLine();

                        Console.WriteLine($"Physical memory usage     : {myProcess.WorkingSet}");
                        Console.WriteLine($"Base priority             : {myProcess.BasePriority}");
                        Console.WriteLine($"Priority class            : {myProcess.PriorityClass}");
                        Console.WriteLine($"User processor time       : {myProcess.UserProcessorTime}");
                        Console.WriteLine($"Privileged processor time : {myProcess.PrivilegedProcessorTime}");
                        Console.WriteLine($"Total processor time      : {myProcess.TotalProcessorTime}");
                        Console.WriteLine($"Process's Name            : {myProcess}");
                        Console.WriteLine("-------------------------------------");

                        if (myProcess.Responding)
                        {
                            Console.WriteLine("Status:  Responding to user interface");
                            myProcess.Refresh();
                        }
                        else
                        {
                            Console.WriteLine("Status:  Not Responding");
                        }

                        Thread.Sleep(1000);
                    }

                    Console.WriteLine();
                    Console.WriteLine($"Process exit code: {myProcess.ExitCode}");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine($"The following exception was raised: {e.Message}");
            }
        }
    }
}
Imports System.Diagnostics
Imports System.Threading

Namespace Process_Sample
    Class MyProcessClass

        Public Shared Sub Main()
            Try

                Using myProcess = Process.Start("NotePad.exe")

                    While Not myProcess.HasExited

                        Console.WriteLine()

                        Console.WriteLine($"Process's physical memory usage          : {myProcess.WorkingSet}")
                        Console.WriteLine($"Base priority of the associated process  : {myProcess.BasePriority}")
                        Console.WriteLine($"Priority class of the associated process : {myProcess.PriorityClass}")
                        Console.WriteLine($"User processor time                      : {myProcess.UserProcessorTime}")
                        Console.WriteLine($"Privileged processor time                : {myProcess.PrivilegedProcessorTime}")
                        Console.WriteLine($"Total processor time                     : {myProcess.TotalProcessorTime}")
                        Console.WriteLine($"Process's name                           : {myProcess}")
                        Console.WriteLine("-------------------------------------")

                        If myProcess.Responding Then
                            Console.WriteLine("Status:  Responding to user interface")
                            myProcess.Refresh()
                        Else
                            Console.WriteLine("Status:  Not Responding")
                        End If
                        Thread.Sleep(1000)
                    End While

                    Console.WriteLine()
                    Console.WriteLine($"Process exit code: {myProcess.ExitCode}")
                End Using

            Catch e As Exception
                Console.WriteLine($"The following exception was raised: {e.Message}")
            End Try
        End Sub
    End Class
End Namespace 'Process_Sample

설명

이 속성에서 반환되는 값은 프로세스에서 사용하는 작업 집합 메모리의 가장 최근에 새로 고친 크기(바이트)를 나타냅니다. 최신 크기를 최대한 활용하려면 먼저 메서드를 호출 Refresh() 해야 합니다.

프로세스의 작업 세트는 현재 물리적 RAM 메모리의 프로세스에 표시되는 메모리 페이지 세트입니다. 이러한 페이지는 상주 하며 페이지 오류를 일으키지 않고 애플리케이션에 사용할 수 있습니다.

작업 집합에는 공유 데이터와 프라이빗 데이터가 모두 포함됩니다. 공유 데이터에는 프로세스 모듈 및 시스템 라이브러리를 포함하여 프로세스가 실행하는 모든 지침이 포함된 페이지가 포함됩니다.

적용 대상

추가 정보