3
我的服务器代码中有很多HTTPHandlers。
如何监视Live中我的Web服务器的性能?
我需要在下一个统计:
1.每秒请求
2. CPU使用率(每个处理器或摘要的)ASP.NET Live活动监视器
在此先感谢
我的服务器代码中有很多HTTPHandlers。
如何监视Live中我的Web服务器的性能?
我需要在下一个统计:
1.每秒请求
2. CPU使用率(每个处理器或摘要的)ASP.NET Live活动监视器
在此先感谢
请尝试这些链接和这些行代码此一定会帮助你。
http://www.codeproject.com/KB/dotnet/perfcounter.aspx http://www.aspheute.com/english/20000809.asp http://www.csharphelp.com/2006/05/performance-monitoring/
可以使用PerformanceCounter类从System.Diagnostics:
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";
}
这些所有的事情都会解决您的问题。