ASP.NET 实时活动监视器

发布于 2024-08-25 12:12:20 字数 128 浏览 4 评论 0原文

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

提前致谢

I have a lot of HTTPHandlers in my server code.
How can I monitor performance of my web server in Live?
I need the next statistics:
1. Requests per second (of each handler or summary)
2. CPU-usage

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

画中仙 2024-09-01 12:12:20

请尝试这些链接和这些代码行,这肯定会对您有所帮助。

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

您可以使用 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";
}

这些全部事情会解决你的问题。

Please try these links and these line of code this will surely help you.

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

You can use the PerformanceCounter class from 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";
}

These all things will solve your problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文