查看主机的内存使用情

查看主机的内存使用情  
  作者:豆腐
转自:豆腐技术站

/*
http://www.asp888.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>

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值