哪些 .NET 性能和/或内存分析器允许我分析 DLL?
我为其他程序编写了很多基于 .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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是的,确实是这样。 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.
.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.
这可能不再与您相关,但我想我应该把它放在这里供后代使用,Redgate Ants 分析器确实允许您使用自定义过滤器分析单个 dll:
http://www.red-gate.com/supportcenter/content/ANTS_Profiler/articles/profiling_single_dotnet_ assembly
包含来自网站的文本,以防链接失效。
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
Included text from the website in case that link ever goes dead.