附加到正在运行的进程的探查器?
我需要一个适用于 Windows 和 Linux 的良好分析器(它们不必是同一个;针对每个操作系统的单独建议都可以),它可以附加到未以任何“特殊”方式编译的已运行进程,并给出我对进程花费大部分时间的函数进行统计。我有一些长时间运行的科学代码,我想获取它在执行的各个阶段花费大部分时间的快照,并且能够获得无需从头到尾运行整个程序即可获得结果。
我正在使用的编译器(Digital Mars D)附带了一个仪器分析器。对于我正在运行的作业来说太慢了。由于我只对识别主要瓶颈感兴趣,因此我想要一些快速且易于使用的东西,即使它只是大致准确。理想情况下,它还应该能够同时分析所有线程并为我提供汇总报告。
在 Linux 上,我一直使用 GDB 作为穷人的采样分析器(暂停我的应用程序几次,看看它有什么功能)。基本上,我正在寻找一个更自动化的版本。
最后一个要求:在 Linux 上,它必须能够在没有 root 权限的情况下轻松安装,因为我将在没有 root 访问权限的服务器上运行它。
编辑:虽然代码是用 D 编写的,但 D 的编译模型等与 C 的非常相似,因此为 C 编写的工具应该可以正常工作。
I need a good profiler for both Windows and Linux (they don't have to be the same one; separate recommendations for each OS are fine) that can attach to an already running process that was not compiled in any "special" way and give me statistics on what functions the process is spending most of its time in. I have some long running scientific code and I want to get snapshots of where it's spending most of its time at various stages of execution, and be able to get the results without having to run the whole program start to finish.
The compiler I'm using (Digital Mars D) comes with an instrumenting profiler. It's way too slow for the jobs I'm running. Since I'm only interested in identifying major bottlenecks, I want something fast and easy to use, even if it's only roughly accurate. Ideally it should also be able to profile all threads simultaneously and give me an aggregate report.
On Linux, I've been using GDB as a poor man's sampling profiler (pausing my app a few times and seeing what function it's in). Basically, a more automated version of this is what I'm looking for.
One last requirement: On Linux it has to be easy to install without root privileges, since I'm going to be running it on a server that I don't have root access to.
Edit: While the code was written in D, D's compilation model, etc. is similar enough to C's that tools written for C should work fine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
如果您有一个相当新的内核,您可以使用
perf
:...然后在收集了足够的样本后使用
perf report
。If you have a fairly recent kernel you can use
perf
:...then
perf report
once you've gathered enough samples.您正在寻找 oprofile:
http://oprofile.sourceforge.net/
You're looking for oprofile:
http://oprofile.sourceforge.net/
对于 Linux,请尝试 Zoom。另外,对于粗略的工作,
lsstack
对于查找瓶颈很有用。For Linux, try Zoom. ALso, for rough work,
lsstack
is useful for finding bottlenecks.我没有尝试过,但是xProf是专门为D编写的。它是一个统计分析器。
I haven't tried it, but xProf was written specifically for D. It's a statistical profiler.
Windows 性能记录器 (WPR) 和 Windows 性能分析器 (WPA) 是适用于 Windows 8 及更高版本的最佳分析工具。 Xperf 在 Windows 7 上运行得非常好。
Windows Performance Recorder (WPR) and Windows Performance Analyzer (WPA) are best profiling tools for Windows 8 and above. Xperf works really well on Windows 7.