ASP.NET Live活动监视器

Val*_*tin 3 asp.net monitor live

我的服务器代码中有很多HTTPHandler.
如何在Live中监控我的Web服务器的性能?
我需要下一个统计信息:
1.每秒请求数(每个处理程序或摘要)
2.CPU使用率

提前致谢

Pan*_*hra 6

请尝试这些链接和这些代码,这一定会对您有所帮助.

http://www.codeproject.com/KB/dotnet/perfcounter.aspx http://www.aspheute.com/english/20000809.asp http://www.csharphelp.com/2006/05/performance-monitoring/

您可以使用System.Diagnostics中PerformanceCounter类:

PerformanceCounter cpuCounter;
PerformanceCounter ramCounter;

cpuCounter = new PerformanceCounter();

cpuCounter.CategoryName = "Processor";
cpuCounter.CounterName = "% Processor Time";
cpuCounter.InstanceName = "_Total";

ramCounter = new PerformanceCounter("Memory", "Available MBytes");


public string getCurrentCpuUsage(){
            cpuCounter.NextValue()+"%";
}

public string getAvailableRAM(){
            ramCounter.NextValue()+"MB";
}
Run Code Online (Sandbox Code Playgroud)

这些都将解决您的问题.