ASP.NET查看主机内存的使用情况
点击次数:23 次 发布日期:2008-12-10 21:48:08 作者:源代码网
|
源代码网推荐
这个是我在国外的一个站点上看到的使用Asp.Net得到一些系统变量的程序,
大家可以看看,其实这个程序没有多大的用处,只是说明一下asp.Net 的强大功能而已。
<scriptlanguage="C#"runat=server> voidPage_Load(Objectsender,EventArgsev) { ProcessInfo[]history=ProcessModelInfo.GetHistory(100); for(inti=0;i<history.Length;i++) { Response.Write("StartTime:"+history.StartTime.ToString()+"<BR>"); Response.Write("Age:"+history.Age.ToString()+"<BR>"); Response.Write("ProcessID:"+history.ProcessID.ToString()+"<BR>"); Response.Write("RequestCount:"+history.RequestCount.ToString()+"<BR>"); Response.Write("Status:"+GetProcessStatus(history.Status)+"<BR>"); Response.Write("ShutdownReason:"+GetShutdownReason(history.ShutdownReason)+"<BR>"); Response.Write("PeakMemoryUsed:"+history.PeakMemoryUsed.ToString()+"<BR>"); } } publicStringGetProcessStatus(ProcessStatusps) { Strings="Unknown"; if(ps==ProcessStatus.Alive) s="Alive"; elseif(ps==ProcessStatus.ShuttingDown) s="ShuttingDown"; elseif(ps==ProcessStatus.ShutDown) s="Shutdown"; elseif(ps==ProcessStatus.Terminated) s="Terminated"; returns; } publicStringGetShutdownReason(ProcessShutdownReasonpsr) { Strings="Unknown"; if(psr==ProcessShutdownReason.None) s="N/A"; elseif(psr==ProcessShutdownReason.Unexpected) s="Unexpected"; elseif(psr==ProcessShutdownReason.RequestsLimit) s="RequestsLimit"; elseif(psr==ProcessShutdownReason.RequestQueueLimit) s="RequestQueueLimit"; elseif(psr==ProcessShutdownReason.Timeout) s="Timeout"; elseif(psr==ProcessShutdownReason.IdleTimeout) s="IdleTimeout"; elseif(psr==ProcessShutdownReason.MemoryLimitExceeded) s="MemoryLimitExceeded"; returns; } </script>
本文作者:未知
源代码网供稿. |