大家总是说,在执行前的优化来分析你的程序,但没有人曾经介绍了如何做到这一点。
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 (如解释如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廓建议?
发布评论