C++ 代码分析器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/239742/
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
C++ Code Profiler
提问by andygeers
Can anybody recommend a good code profiler for C++?
有人可以为 C++ 推荐一个好的代码分析器吗?
I came across Shiny - any good? http://sourceforge.net/projects/shinyprofiler/
我遇到了 Shiny - 有什么好处吗?http://sourceforge.net/projects/shinyprofiler/
采纳答案by Igor Semenov
回答by moogs
Not C++ specific, but AMD's CodeAnalyst software is free and is feature-packed.
不是特定于 C++ 的,但 AMD 的 CodeAnalyst 软件是免费的并且功能丰富。
http://developer.amd.com/cpu/codeanalyst/codeanalystwindows/Pages/default.aspx
http://developer.amd.com/cpu/codeanalyst/codeanalystwindows/Pages/default.aspx
回答by artificialidiot
回答by Alexandr Kurylev
Probably you will be interested in Intel VTune. Rather useful and allows to collect low-level events like cache misses which helps a lot in tuning.
您可能会对英特尔 VTune感兴趣。相当有用,并允许收集低级事件,如缓存未命中,这对调整有很大帮助。
回答by Mike Dunlavey
Depends on what you need to do:
取决于你需要做什么:
- Measure, so you can do regressions testing to see if changes in performance happened.
- Find reasons for suboptimal performance and optimize them.
- 测量,因此您可以进行回归测试以查看性能是否发生了变化。
- 找出性能欠佳的原因并优化它们。
These are not the same.
这些是不一样的。
For 1, use one of the recommended profilers.
对于 1,使用推荐的分析器之一。
For 2, the profiler I much prefer is one you already have:
http://www.wikihow.com/Optimize-Your-Program%27s-Performance
To see how this goes, check this out.
对于 2,我更喜欢的分析器是您已经拥有的分析器:
http: //www.wikihow.com/Optimize-Your-Program%27s-Performance
要了解情况如何,请查看此内容。
For C++, as for C# and any language that encourages layers of abstraction, those layers may or may not be good from a software engineering standpoint, but they can kill performance. Every method call is a detour in the execution of your program, and the style encourages you to nest those things, sometimes needlessly. Also the style discourages you from knowing or caring what goes on inside them. You may find them creating and deleting objects underneath at a rate and level of generality far beyond what your application really needs.
对于 C++、C# 和任何鼓励抽象层的语言,从软件工程的角度来看,这些层可能好也可能不好,但它们会降低性能。每个方法调用都是程序执行过程中的一个弯路,这种风格鼓励你嵌套这些东西,有时是不必要的。此外,这种风格会阻止您了解或关心其中发生的事情。您可能会发现它们以远远超出您的应用程序真正需要的速度和通用级别创建和删除下面的对象。
回答by graham.reeds
If you are running a Premium version of VS 2010 then you get a profiler with it.
如果您运行的是 VS 2010 的高级版本,那么您将获得一个带有它的分析器。
I've also used a couple of other free ones, but they don't compare to the on MS ships. Useful as a second opinion though.
我还使用了其他几个免费的,但它们无法与 MS 船上的相比。不过作为第二意见很有用。
回答by Timo Geusch
Quantify (part of the IBM/Rational PurifyPlus package) is a very good profiler, but not exactly cheap. It is available on several platforms, too - I've used it on Solaris, Windows and Linux.
Quantify(IBM/Rational PurifyPlus 软件包的一部分)是一个非常好的分析器,但并不便宜。它也可以在多个平台上使用 - 我已经在 Solaris、Windows 和 Linux 上使用过它。
回答by Matt Schuetze
If you cannot locate DevPartner it is because we've moved under new ownership. Check us out on the Micro Focus website: http://www.microfocus.com/products/micro-focus-developer/devpartner/index.aspx. Shameless plug: I work on the DevPartner team. Our long awaited 64-bit versions of BoundsChecker and C++/.NET profilers ship on February 4, 2011. We've changed our pricing model so you can choose either the whole suite or just the performance profiler if that's what you need. Please check out the new DPS 10.5 release when it goes live!
如果您找不到 DevPartner,那是因为我们已转移到新的所有权下。在 Micro Focus 网站上查看我们:http: //www.microfocus.com/products/micro-focus-developer/devpartner/index.aspx。无耻的插件:我在 DevPartner 团队工作。我们期待已久的 64 位版本的 BoundsChecker 和 C++/.NET 分析器于 2011 年 2 月 4 日发布。我们已经更改了定价模型,因此您可以选择整个套件或仅选择性能分析器(如果您需要的话)。请在发布时查看新的 DPS 10.5 版本!