首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ASP.NET实时活动监视器

ASP.NET实时活动监视器
EN

Stack Overflow用户
提问于 2010-03-16 21:59:46
回答 1查看 483关注 0票数 3

我的服务器代码中有很多HTTPHandlers。

如何在Live中监视web服务器的性能?

我需要下面的统计数据:

每秒的

  1. 请求数(每个处理程序或summary)
  2. CPU-usage

提前感谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 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

代码语言:javascript
复制
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";
}

所有这些都会解决你的问题。

票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2454890

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档