ProcessInfo Klasa

Definicja

Zawiera informacje o aktualnie wykonywanych procesach.

public ref class ProcessInfo
public class ProcessInfo
type ProcessInfo = class
Public Class ProcessInfo
Dziedziczenie
ProcessInfo

Przykłady

Poniższy przykład kodu przedstawia użycie Agewłaściwości ProcessInfo klasy , , PeakMemoryUsedProcessID, RequestCount, ShutdownReasonStartTime i Status . W przykładzie jest wyświetlana wartość LinkButton. Po kliknięciu LinkButton zostanie wyświetlona bieżąca informacja o procesie.

<%@ 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>

Uwagi

Ta klasa zwraca informacje o procesach roboczych ASP.NET uruchomionych w ramach modelu procesów ASP.NET. Obiekty tego typu są zwracane przez metody ProcessModelInfo.GetCurrentProcessInfo statyczne i ProcessModelInfo.GetHistory. Te metody są jedynymi przydatnymi sposobami tworzenia zainicjowanego obiektu.

Uwaga

Jeśli używasz Microsoft Internet Information Services (IIS) 6.0, metryki procesów zwracane przez ProcessInfo klasy są dostępne tylko w przypadku uruchamiania w trybie izolacji usług IIS 5.0. Jeśli używasz usług IIS 6.0 w trybie izolacji procesów roboczych, model procesu ASP.NET jest wyłączony i HttpException zgłaszany jest wyjątek podczas uzyskiwania dostępu do ProcessInfo elementów członkowskich.

Konstruktory

ProcessInfo()

Inicjuje nowe wystąpienie klasy ProcessInfo.

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

Inicjuje ProcessInfo nowe wystąpienie klasy i ustawia informacje wewnętrzne wskazujące stan procesu.

Właściwości

Age

Pobiera czas działania procesu.

PeakMemoryUsed

Pobiera maksymalną ilość pamięci używanej przez proces.

ProcessID

Pobiera numer identyfikacyjny przypisany do procesu.

RequestCount

Pobiera liczbę żądań rozpoczęcia procesu.

ShutdownReason

Pobiera wartość wskazującą, dlaczego proces został zamknięty.

StartTime

Pobiera czas rozpoczęcia procesu.

Status

Pobiera bieżący stan procesu.

Metody

Equals(Object)

Określa, czy dany obiekt jest taki sam, jak bieżący obiekt.

(Odziedziczone po Object)
GetHashCode()

Służy jako domyślna funkcja skrótu.

(Odziedziczone po Object)
GetType()

Type Pobiera wartość bieżącego wystąpienia.

(Odziedziczone po Object)
MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
SetAll(DateTime, TimeSpan, Int32, Int32, ProcessStatus, ProcessShutdownReason, Int32)

Ustawia informacje wewnętrzne wskazujące stan procesu.

ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Dotyczy