我的服务器代码中有很多HTTPHandlers。
如何在Live中监视web服务器的性能?
我需要下面的统计数据:
每秒的
提前感谢
发布于 2010-09-21 14:17:34
请尝试这些链接和这些代码行,这肯定会对您有所帮助。
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";
}所有这些都会解决你的问题。
https://stackoverflow.com/questions/2454890
复制相似问题