ProcessModelInfo 类
定义
包含用于返回有关辅助进程的信息的方法。Contains methods that return information about worker processes.
public ref class ProcessModelInfo
public class ProcessModelInfo
type ProcessModelInfo = class
Public Class ProcessModelInfo
- 继承
-
ProcessModelInfo
示例
下面的代码示例演示如何调用 GetCurrentProcessInfo 方法,以在网页上显示有关当前正在执行的 ASP.NET 进程的统计信息。The following code example demonstrates how to call the GetCurrentProcessInfo method to display statistics about the currently executing ASP.NET process on a Web page. 此示例适用于 Windows 2000 和 Windows XP 上的 Internet Information Services 5.0,或 Windows Server 2003 上的 IIS 6.0 和使用 IIS 5.0 隔离模式。This example will work with Internet Information Services 5.0 on Windows 2000 and Windows XP or with IIS 6.0 on Windows Server 2003 and using IIS 5.0 isolation mode.
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
private void Page_Load(object sender, EventArgs e)
{
DataGrid1.DataSource = GetProcessInfoAsDataSet();
DataGrid1.DataBind();
}
private DataSet GetProcessInfoAsDataSet()
{
DataSet ds = new DataSet();
ds.Tables.Add(new DataTable());
ds.Tables[0].Columns.Add("ID", typeof(string));
ds.Tables[0].Columns.Add("Start Time", typeof(string));
ds.Tables[0].Columns.Add("Age", typeof (string));
ds.Tables[0].Columns.Add("Request Count", typeof(string));
ds.Tables[0].Columns.Add("Peak Memory",typeof(string));
ProcessInfo info = ProcessModelInfo.GetCurrentProcessInfo();
DataRow row = ds.Tables[0].NewRow();
row["ID"] = info.ProcessID;
row["Start Time"] = info.StartTime;
row["Age"] = info.Age;
row["Request Count"] = info.RequestCount;
row["Peak Memory"]= info.PeakMemoryUsed;
ds.Tables[0].Rows.Add(row);
return ds;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ASP.NET Example</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DataGrid
ID="DataGrid1"
runat="server" />
</div>
</form>
</body>
</html>
<%@ Page Language="VB" %>
<%@ Import Namespace="System.Data" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Sub Page_Load(sender As Object, e As EventArgs)
DataGrid1.DataSource = GetProcessInfoAsDataSet()
DataGrid1.DataBind()
End Sub
Function GetProcessInfoAsDataSet() As DataSet
Dim ds As New DataSet
Dim dt As New DataTable
ds.Tables.Add(dt)
ds.Tables(0).Columns.Add("ID", GetType(String))
ds.Tables(0).Columns.Add("Start Time", GetType(String))
ds.Tables(0).Columns.Add("Age", GetType(String))
ds.Tables(0).Columns.Add("Request Count", GetType(String))
ds.Tables(0).Columns.Add("Peak Memory", GetType(String))
Dim info As ProcessInfo
info = ProcessModelInfo.GetCurrentProcessInfo()
Dim row As DataRow
row = ds.Tables(0).NewRow()
row("ID") = info.ProcessID
row("Start Time") = info.StartTime
row("Age") = info.Age
row("Request Count") = info.RequestCount
row("Peak Memory")= info.PeakMemoryUsed
ds.Tables(0).Rows.Add(row)
Return ds
End Function
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ASP.NET Example</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DataGrid
ID="DataGrid1"
runat="server" />
</div>
</form>
</body>
</html>
注解
ProcessModelInfo类不应在自己的代码中实例化。The ProcessModelInfo class is not meant to be instantiated in your own code. 使用静态 GetCurrentProcessInfo 和 GetHistory 方法填充 ProcessInfo 对象,然后使用对象的属性 ProcessInfo 来获取有关进程的信息。Use the static GetCurrentProcessInfo and GetHistory methods to populate ProcessInfo objects, and then use the properties of the ProcessInfo objects to obtain information about the processes.
备注
GetCurrentProcessInfo和 GetHistory 方法只能与 microsoft Internet Information Services (在 microsoft windows 2000 和 windows XP 上的 iis) 版本5.0,或者在 windows Server 2003 上使用 iis 6.0,并使用 iis 5.0 隔离模式。The GetCurrentProcessInfo and GetHistory methods can be used only with Microsoft Internet Information Services (IIS) version 5.0 on Microsoft Windows 2000 and Windows XP or with IIS 6.0 on Windows Server 2003 and using IIS 5.0 isolation mode. 有关详细信息,请参阅 如何:为 ASP.NET 版本配置 ASP.NET 应用程序。For more information, see How to: Configure ASP.NET Applications for an ASP.NET Version.
构造函数
| ProcessModelInfo() |
初始化 ProcessModelInfo 类的新实例。Initializes a new instance of the ProcessModelInfo class. |
方法
| Equals(Object) |
确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object. (继承自 Object) |
| GetCurrentProcessInfo() |
返回有关执行当前请求的辅助进程的信息。Returns information about the worker process that is executing the current request. |
| GetHashCode() |
作为默认哈希函数。Serves as the default hash function. (继承自 Object) |
| GetHistory(Int32) |
返回有关近期的辅助进程的信息。Returns information about recent worker processes. |
| GetType() |
获取当前实例的 Type。Gets the Type of the current instance. (继承自 Object) |
| MemberwiseClone() |
创建当前 Object 的浅表副本。Creates a shallow copy of the current Object. (继承自 Object) |
| ToString() |
返回表示当前对象的字符串。Returns a string that represents the current object. (继承自 Object) |