哪些 .NET 性能和/或内存分析器允许我分析 DLL?

发布于 2024-08-24 19:44:42 字数 254 浏览 3 评论 0原文

我为其他程序编写了很多基于 .NET 的插件,这些插件通常编译为 DLL,由本机应用程序启动。我一直在使用 Equatec 的分析器,它效果很好,但现在想要具有更多功能的东西,包括分析内存使用情况的能力。

我尝试了 Red Gate 的 Ant Profiler,但据我所知,无法分析 DLL。唯一的选择是分析 EXE。

所以我的问题是还有哪些其他分析工具可以让我分析单个库 DLL 而不是 EXE。我假设这需要像 Equatec 那样将配置文件代码注入到库中?

I write a lot of .NET based plug-ins for other programs which are usually compiled as a DLL which is up to the native application to start up. I've been using Equatec's profiler, which works great, but now would like something with more features, including the ability to profile memory usage.

I tried out Red Gate's Ant Profiler, but as far as I can see there is no way to profile a DLL. The only option is to profile an EXE.

So my question is what other profiling tools are available that will allow me to profile a single library DLL rather than an EXE. I'm assuming this would require injecting profile code into the library as Equatec does?

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

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

发布评论

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

评论(3

青衫负雪 2024-08-31 19:44:42

是的,确实是这样。 DLL 只是一堆代码,它与 EXE 中的代码合并。 DLL 不能“拥有”任何内存,但 AppDomain 可以。不过,您可以看到来自 DLL 的代码花费了多少时间。

如果您编写的测试程序本身不进行任何主要内存分配,但调用 DLL 中类的方法,那么您可以毫无问题地将内存使用情况归因于 DLL。然而,编写这样的测试程序并使其类似于在真实程序中使用 DLL 代码的方式并不那么容易。

Yes, that does work this way. A DLL is just a blob of code, it gets merged with the code in the EXE. A DLL cannot "own" any memory, an AppDomain does. You can however see how much time is spent in the code that came from a DLL.

If you write a test program that itself doesn't make any major memory allocations but does call the methods of the classes in the DLL then you can attribute the memory usage to the DLL without a problem. Writing such a test program and make it resemble the way the DLL code is used in a real program is however not that easy.

你げ笑在眉眼 2024-08-31 19:44:42

.Net 内存验证器.Net 性能验证器 都允许您仅分析 dll。

您必须在设置对话框的“Hooked DLL”部分中指定您感兴趣(或不感兴趣)的 DLL。然后启动您的应用程序 - 仅收集指定 DLL 中的数据。

全面披露:我是创建这些工具的公司的软件工程师。

.Net Memory Validator and .Net Performance Validator both allow you to profile just a dll.

You have to specify the DLLs you are interested in (or not interested in) in the "Hooked DLLs" part of the settings dialog. Then launch your application - only data from the specified DLL is collected.

Full disclosure: I am a software engineer at the company that creates these tools.

御守 2024-08-31 19:44:42

这可能不再与您相关,但我想我应该把它放在这里供后代使用,Redgate Ants 分析器确实允许您使用自定义过滤器分析单个 dll:

http://www.red-gate.com/supportcenter/content/ANTS_Profiler/articles/profiling_single_dotnet_ assembly

我们使用 ANTS Profiler 3 项目向导以通常的方式设置“CoolApp”的性能分析。向导的最后一个屏幕是我们可以自定义项目以将分析限制为仅一个库的点。我们指定要使用自定义过滤器来限制将进行分析的应用程序区域。

我们编辑自定义过滤器并指定我们只对分析特定命名空间感兴趣,如下所示。在本例中,我们设置了一个过滤器,使 ANTS Profiler 仅分析属于 RedGate.Library1 命名空间的方法。这正是我们想要的,现在我们准备开始分析。

我们现在可以按照通常的方式进行分析。但是,当我们通过拍摄快照或关闭应用程序获得性能分析结果时,它们将仅包含有关 RedGate.Library1.dll 中方法的数据。

包含来自网站的文本,以防链接失效。

This may no longer be relevant for you but I thought I'd put it out here for posterity, Redgate Ants profiler does allow you to profile a single dll using a custom filter:

http://www.red-gate.com/supportcenter/content/ANTS_Profiler/articles/profiling_single_dotnet_assembly

We set up performance profiling of "CoolApp" in the usual fashion, using the ANTS Profiler 3 project wizard. The final screen of the wizard is the point at which we can customize the project to restrict profiling to just one library. We specify that we want to use a Custom filter to limit the areas of the application that will be profiled.

We edit the custom filter and specify that we are only interested in profiling a particular namespace, as shown below. In this case, we set up a filter that will cause ANTS Profiler to only profile methods that are part of the RedGate.Library1 namespace. This is exactly what we want, and we are now ready to start profiling.

We can now proceed with profiling in the usual fashion. However, when we get performance profiling results, either by taking a snapshot, or by closing down the application, they will only contain data about methods in RedGate.Library1.dll.

Included text from the website in case that link ever goes dead.

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