程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> ASP.NET >> 關於ASP.NET >> 查看主機的內存使用情況

查看主機的內存使用情況

編輯:關於ASP.NET

這個是我在國外的一個站點上看到的使用Asp.Net得到一些系統變量的程序,
大家可以看看,其實這個程序沒有多大的用處,只是說明一下asp.Net 的強大功能而已。
<script language="C#" runat=server>
void Page_Load(Object sender, EventArgs ev)
{
ProcessInfo[] history = ProcessModelInfo.GetHistory(100);
for( int i=0; i<history.Length; i++ )
{
Response.Write("StartTime:"+ history[i].StartTime.ToString() + "<BR>");
Response.Write("Age:" + history[i].Age.ToString() + "<BR>");
Response.Write("ProcessID:" + history[i].ProcessID.ToString() + "<BR>");
Response.Write("RequestCount:" + history[i].RequestCount.ToString() + "<BR>");
Response.Write("Status:" + GetProcessStatus(history[i].Status ) + "<BR>");
Response.Write("ShutdownReason:" + GetShutdownReason(history[i].ShutdownReason) + "<BR>");
Response.Write("PeakMemoryUsed:" + history[i].PeakMemoryUsed.ToString() + "<BR>");

}
}

public String GetProcessStatus( ProcessStatus ps )
{
String s = "Unknown";
if( ps == ProcessStatus.Alive )
s = "Alive";
else if( ps == ProcessStatus.ShuttingDown )
s = "Shutting Down";
else if( ps == ProcessStatus.ShutDown )
s = "Shutdown";
else if( ps == ProcessStatus.Terminated )
s = "Terminated";
return s;
}

public String GetShutdownReason( ProcessShutdownReason psr )
{
String s = "Unknown";
if( psr == ProcessShutdownReason.None )
s = "N/A";
else if( psr == ProcessShutdownReason.Unexpected )
s = "Unexpected";
else if( psr == ProcessShutdownReason.RequestsLimit )
s = "Requests Limit";
else if( psr == ProcessShutdownReason.RequestQueueLimit )
s = "Request Queue Limit";
else if( psr == ProcessShutdownReason.Timeout )
s = "Timeout";
else if( psr == ProcessShutdownReason.IdleTimeout )
s = "Idle Timeout";
else if( psr == ProcessShutdownReason.MemoryLimitExceeded )
s = "Memory Limit Exceeded";
return s;
}
</script>

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved