Win64 下可靠的 .NET 3.5 CPU 分析器,具有命令行支持?
我正在寻找一个用于 .NET 支持
- 重线程应用程序的 CPU 分析器。
- (双)四核 CPU。
- 抽样分析。
- 64 位操作系统。
- 命令行 API。
目前,我在使用大多数 .NET 分析器时遇到了麻烦,特别是
- YourKit 似乎不支持命令行。
- dotTrace 3.1 在 64 位操作系统中崩溃。
到目前为止我还没有尝试过英特尔VTune。 有什么开明的建议吗?
I am looking for a CPU profiler for .NET supporting
- heavily threaded apps.
- (double) quad-core CPUs.
- sampling profiling.
- 64 bits OS.
- command-line API.
Currently, I am getting trouble with most .NET profilers, in particular,
- YourKit does not seem to support command-line.
- dotTrace 3.1 is crashing with 64 bits OS.
I haven't tried Intel VTune so far. Any enlightened suggestion?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
线程往往会让大多数分析器感到困惑,因为他们不确定如何计算一个线程被阻塞等待另一个线程的时间以及线程等待工作的时间(如果您不使用线程池)。
根据我们的经验,您应该检查两个分析器:
1. Eqatech 有一个免费的分析器,可以进行代码注入以进行分析。 它仅适用于方法级别,但可以在 64 位上运行,并且可以让您了解您的时间都花在哪里了。
2. Red-Gate ANT 分析器是我们用来深入研究行级计时的最佳工具,如果您遇到线程在执行时间的很大一部分时间里相互阻塞等待的情况,这一点就至关重要。
也就是说,如果您可以在没有用户界面的情况下运行测试,我强烈建议您设置一些 NUnit 性能测试,以便您每次都可以快速轻松地以完全相同的方式重复它们。 这样做,即使使用方法级分析器,您也可以看到时间都花在哪里,提出并检查单独的优化等。您会惊讶地发现,从一个地方花费时间只是将其添加到另一个地方,因为线程最终会相互等待,因此拥有完美可重复的测试非常有用。
Eqatech 分析器会修改您编译的 IL,因此每当您重新运行该 IL 时,您都会获得一个新的性能跟踪文件,因此它应该适合您的命令行场景。 我相信 ANT 也能起到类似的作用。
最后,如果您的应用程序要在多个环境中使用,我绝对建议在单个处理器或仅超线程的处理器上运行一些性能测试。 当您非常积极地调整多核时,您最终可能会增加足够的开销,从而可能导致死锁或在少量处理器上运行缓慢。
Threading tends to confuse most profilers in that they aren't sure how to count time that one thread is blocked waiting on another and time a thread is waiting around for work (if you aren't using the thread pool).
There are two profilers that you should check out in our experience:
1. Eqatech has a free profiler that does code injection for profiling. It only works down to the method level, but does work on 64 bit and can give you a sense of where your time is going.
2. The Red-Gate ANT profiler is the best we've used for drilling into line level timings which is critical if you have a scenario where threads are blocked waiting on each other for a significant part of their execution time.
That said, if you can run your tests without a user interface I highly recommend setting up some NUnit performance tests so you can quickly and easily repeat them exactly the same way each time. Doing this you can see where your time is going even with a method level profiler, propose and check individual optimizations, etc. You'll be surprised how taking time from one place just adds it to another because the threads end up waiting on each other, so having a perfectly repeatable test is very useful.
The Eqatech profiler modifies your compiled IL so whenever you re-run that IL you get a new performance tracing file, so it should fit your command line scenario. I believe ANT can work similarly.
Finally, if your application is going to be used in multiple environments I'd definitely recommend running a few performance test runs on a single processor or hyperthread only processor. When you get very aggressive about tuning for multicores you can end up adding enough overhead that you may deadlock or just be slow on small numbers of processors.
Redgate 有一个分析器(如果我没记错的话)无法告诉你它是否有您需要的一切,但尝试一下? :)
Redgate has a profiler if i remember right cant tell you if it has all you need but give it a try? :)
-- 编辑2 ---
另一种可能的选择(但需要更多努力)是使用 NProf 并将源代码调整为去掉GUI?
AQTime 很好地支持 64 位操作系统上的命令行应用程序。
--- 编辑 ---
AQTime 还支持命令行 API。 它可以选择自动启动项目、配置文件并退出。 我相信它会满足您的所有标准,并支持托管+本机代码库。
从命令行上的 AQTime 帮助中:
“如您所见,使用命令行参数您可以启动 AQtime、在其中加载项目、开始分析并在分析完成后关闭 AQtime。所有这些使您能够集成 AQtime例如,在每个应用程序构建后运行这些测试,您可以轻松查看应用程序代码的更改是否导致性能瓶颈或内存使用效率低下。”
-- EDIT 2 ---
Another possible option (but one that would require more effort) would be using NProf and just tweaking the source to strip out the GUI?
AQTime supports command line applications on 64bit OS quite well.
--- EDIT ---
AQTime also does support a command line API. It has the option to launch a project, profile, and exit automatically. I believe it would meet all of your criteria, and supports managed + native codebases.
From the AQTime help on command line:
"As you can see, using command-line arguments you can launch AQtime, load a project in it, start profiling and close AQtime once the profiling has finished. All these give you the ability to integrate AQtime in automated tests of your application. Running these tests after each application build, for instance, you can easily see if changes to the application’s code caused performance bottlenecks or inefficient use of memory."
你的目标是什么?
如果您想测量例程的执行时间和计数,我想您需要一个分析器。
如果您想要发现性能问题,以便修复它们,那就是另一个问题了。
我只是问这个问题,因为不知何故,“它们是相同的”这个想法很流行。
对于后一个目标,尝试过的人都知道,研究线程调用堆栈的一些随机时间样本是发现性能问题的非常有效的方法。
我知道 Java 允许您同时停止所有线程并转储它们的调用堆栈。 我认为 .net 开发环境也会允许同样的事情。
如果没有,只需在 IDE 下运行它并一次停止一个线程,看看它是否浪费了任何周期。 如果是的话,你只需修复它即可。 重复直到找不到任何东西。
如果您对所有线程都执行此操作,那么至少您知道任何缓慢都不是由于任何给定线程中的缓慢造成的。 您仍然可能会遇到不必要的消息流量问题。 诊断起来有点棘手。
What's your goal?
If you want to measure execution times and counts of routines, I guess you need a profiler.
If you want to find performance problems, so you can fix them, that is a different problem.
I'm only asking because somehow the idea got popular that they are the same.
For the latter goal, people who have tried it understand that studying a few random-time samples of the call stack of the threads is a very effective way to find performance problems.
I know Java allows you to stop all threads at the same time and dump their call stacks. I would think the .net development environment would allow the same thing.
If not, just run it under the IDE and halt one thread at a time, to see if it is wasting any cycles. If it is, you just fix it. Repeat until you don't find anything.
If you do this for all threads, then at least you know that any slowness is not due to slowness in any given thread. You could still have a problem of unnecessary message traffic. That's a little more tricky to diagnose.