vb.net .NET 应用程序和性能监控

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21471011/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 16:37:29  来源:igfitidea点击:

.NET Application(s) and performance monitoring

c#.netvb.netperformance-testing

提问by CodingRiot

Got a quick question about how to monitor the performance of my Windows based application (console app, Win Forms app, or Services). I was looking for information about how to correctly and efficiently monitor the performance (CPU utilization, Memory utilized, processes, etc...) for application that were developed in the .NET environment. Is there something in the code that I need to program to trigger availability from WMI? Is there a specific way to create performance counters related directly to your application that your created? I would like to get as much detail about the running app as possible.

有一个关于如何监视基于 Windows 的应用程序(控制台应用程序、Win Forms 应用程序或服务)的性能的快速问题。我一直在寻找有关如何正确有效地监控在 .NET 环境中开发的应用程序的性能(CPU 利用率、内存利用率、进程等)的信息。我需要编写代码中的某些内容来触发 WMI 的可用性吗?是否有一种特定的方法可以创建与您创建的应用程序直接相关的性能计数器?我想尽可能详细地了解正在运行的应用程序。

If it is something that needs to be coded on the application to invoke the WMI monitors, please list examples.

如果需要在应用程序上编码以调用 WMI 监视器,请列出示例。

Additionally, are there any pre-built (open source) application performance testing tools that anyone recommends?

此外,是否有任何人推荐的预构建(开源)应用程序性能测试工具?

采纳答案by Brian Rasmussen

A great way to get insights into the performance of your app is to add ETWinstrumentation. This allows you to monitor what is going on and collect timings as your application is running. If you instrument you app you can answer questions about how long various actions take to complete inside your app.

深入了解应用程序性能的一个好方法是添加ETW检测。这允许您在应用程序运行时监控正在发生的事情并收集时间。如果您检测您的应用程序,您可以回答有关在您的应用程序内完成各种操作需要多长时间的问题。

The .NET runtime and most other components in the Windows stack utilize ETW as well, so you can also get detailed information about memory usage, waits, I/O and so forth.

.NET 运行时和 Windows 堆栈中的大多数其他组件也使用 ETW,因此您还可以获得有关内存使用、等待、I/O 等的详细信息。

ETW is available to managed apps through the EventSourceclass.

ETW 可通过EventSource类用于托管应用程序。

You can use Windows Performance Toolkitor PerfViewto record and analyze events.

您可以使用Windows Performance ToolkitPerfView来记录和分析事件。

回答by Allan Elder

Look at the redgate suite; you can get a free trial. They aren't open source, but they are worth the price.

看看红门套房;您可以获得免费试用。它们不是开源的,但它们物有所值。

http://www.red-gate.com/products/dotnet-development/ants-performance-profiler/

http://www.red-gate.com/products/dotnet-development/ants-performance-profiler/

回答by i3arnon

You can open Performance Monitorand already see all the performance counters .Net(and Windows) give you out of the box. This include memory usage, CPUutilization, locking contention, exceptions and so forth.

您可以打开Performance Monitor并且已经看到所有性能计数器.Net(和Windows)给您开箱即用。这包括内存使用、CPU利用率、锁定争用、异常等。

You can add your own specific performance counters and collect them at the exact same way using PerformanceCounter

您可以添加自己的特定性能计数器并使用完全相同的方式收集它们 PerformanceCounter