对于C廓建议? [英] Recommendations for C Profilers?
问题描述
大家总是说,在执行前的优化来分析你的程序,但没有人曾经介绍了如何做到这一点。
Everyone always says to profile your program before performing optimizations but no-one ever describes how to do so.
什么是您的分析C $ C $ç做法?
What are your practices for profiling C code?
推荐答案
使用 GCC
,我编译和链接 -pg
(如解释如<一个href=\"http://web.archive.org/web/20141129061523/http://www.cs.utah.edu/dept/old/texinfo/as/gprof.html#SEC2\">here),然后通过运行程序(根据还建议在该URL的原则),并使用 gprof的
如果你使用不同的编译器和放大器的工具,将改变持续; C,但仍建议该URL,即使这样,对于那些关于如何以及为什么来分析你的code一般概念的部分。
Using gcc
, I compile and link with -pg
(as explained e.g. here), then continue by running the program (according to the principles also suggested at that URL) and using gprof
. The tools will vary if you're using different compilers &c, but the URL is still recommended, even then, for the parts that are about general ideas on how and why to profile your code.
这篇关于对于C廓建议?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!