Share via


ProcessInfo クラス

定義

現在実行されているプロセスに関する情報を提供します。

public ref class ProcessInfo
public class ProcessInfo
type ProcessInfo = class
Public Class ProcessInfo
継承
ProcessInfo

次のコード例では、クラスの AgePeakMemoryUsed、、ProcessIDShutdownReasonRequestCount、およびStatusStartTimeプロパティを使用する方法をProcessInfo示します。 この例では、LinkButton LinkButtonをクリックすると、現在のプロセス情報が表示されます。

<%@ Page language="c#" AutoEventWireup="false" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head>
    <title>ASP.NET Example</title>
<script language="c#" runat="server">     
      void GetProcessInfo(Object sender, EventArgs e) 
      {
        ProcessInfo pi;

        // Get the current process information.
        pi = ProcessModelInfo.GetCurrentProcessInfo();

        Literal1.Text = "<p>Age: " + pi.Age + "</p>";
        Literal1.Text += "<p>PeakMemoryUsed: " + pi.PeakMemoryUsed + "</p>";
        Literal1.Text += "<p>ProcessID: " + pi.ProcessID + "</p>";
        Literal1.Text += "<p>RequestCount: " + pi.RequestCount + "</p>";
        Literal1.Text += "<p>ShutdownReason: " + pi.ShutdownReason + "</p>";
        Literal1.Text += "<p>StartTime: " + pi.StartTime + "</p>";
        Literal1.Text += "<p>Status: " + pi.Status + "</p>";
      }
      </script>
    </head>
    <body>
    <form id="WebForm1" method="post" runat="server">
      <asp:button id="Button1" OnClick="GetProcessInfo" runat="server" Text="Get Process Info"></asp:button>
             
      <asp:Literal id="Literal1" runat="server"></asp:Literal>
    </form>
  </body>
</html>
<%@ Page language="vb" AutoEventWireup="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head>
    <title>ASP.NET Example</title>
<script language="vb" runat="server">     
      Sub GetProcessInfo(sender As Object, e As System.EventArgs)
        Dim pi As ProcessInfo

        'Get information about the current process.
        pi = ProcessModelInfo.GetCurrentProcessInfo()

        Literal1.Text = "<p>Age: " & pi.Age.ToString & "</p>"
        Literal1.Text = Literal1.Text & "<p>PeakMemoryUsed: " & pi.PeakMemoryUsed.ToString & "</p>"
        Literal1.Text = Literal1.Text & "<p>ProcessID: " & pi.ProcessID.ToString & "</p>"
        Literal1.Text = Literal1.Text & "<p>RequestCount: " & pi.RequestCount.ToString & "</p>"
        Literal1.Text = Literal1.Text & "<p>ShutdownReason: " & pi.ShutdownReason.ToString & "</p>"
        Literal1.Text = Literal1.Text & "<p>StartTime: " & pi.StartTime.ToString & "</p>"
        Literal1.Text = Literal1.Text & "<p>Status: " & pi.Status.ToString & "</p>"
      End Sub
    </script>
  </head>
  <body>
    <form id="WebForm2" method="post" runat="server">
      <asp:button id="Button1" OnClick="GetProcessInfo" runat="server" Text="Get Process Info"></asp:button>
             
      <asp:Literal id="Literal1" runat="server"></asp:Literal>
    </form>
  </body>
</html>

注釈

このクラスは、ASP.NET プロセス モデルで実行されている ASP.NET ワーカー プロセスに関する情報を返します。 この型のオブジェクトは、静的メソッド ProcessModelInfo.GetCurrentProcessInfoProcessModelInfo.GetHistory. これらのメソッドは、初期化されたオブジェクトを作成する唯一の便利な方法です。

注意

Microsoft インターネット インフォメーション サービス (IIS) 6.0 を使用している場合、クラスによってProcessInfo返されるプロセス メトリックは、IIS 5.0 分離モードで実行している場合にのみ使用できます。 ワーカー プロセス分離モードで IIS 6.0 を使用している場合、ASP.NET プロセス モデルは無効になり、HttpExceptionメンバーにアクセスProcessInfoすると例外がスローされます。

コンストラクター

ProcessInfo()

ProcessInfo クラスの新しいインスタンスを初期化します。

ProcessInfo(DateTime, TimeSpan, Int32, Int32, ProcessStatus, ProcessShutdownReason, Int32)

ProcessInfo クラスの新しいインスタンスを初期化し、プロセスのステータスを示す内部情報を設定します。

プロパティ

Age

プロセスの実行時間の長さを取得します。

PeakMemoryUsed

プロセスが消費しているメモリの最大容量を取得します。

ProcessID

プロセスに割り当てられている ID 番号を取得します。

RequestCount

プロセスに対する開始要求の数を取得します。

ShutdownReason

プロセスがシャットダウンされた理由を示す値を取得します。

StartTime

プロセスが開始された時刻を取得します。

Status

プロセスの現在のステータスを取得します。

メソッド

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
SetAll(DateTime, TimeSpan, Int32, Int32, ProcessStatus, ProcessShutdownReason, Int32)

プロセスのステータスを示す内部情報を設定します。

ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象