callgrind : how to check whether a line executed or not

你离开我真会死。 提交于 2020-02-02 11:53:28

问题


Is it possible to use callgrind to produce the output like one given by gcov/lcov ? I'm reading their docs unable to find the exact option for callgrind_annotate


回答1:


It is not possible but callgrind_annotate nor kcachegrind should implement it. However with kcachegrind you have the call's count of each functions/methods.

Column Calls in Cost/All callers tab or Count in Callers tab should be relevant.




回答2:


Yes, you can. Using callgrind --collect-jumps=yes, and the tools described at the link below, you can get much the same information as gcov. It's not as pretty as lcov, but the time savings might just be worth it.

http://benjamin-meyer.blogspot.com/2007/12/valgrind-callgrind-tools-part-3-code.html

Note that this works pretty well even with optimized binaries, so you'll save a bunch of time in your build/test cycle by not having to recompile with --coverage.

You can also merge multiple test runs before using Benjamin's script using cg_merge.



来源:https://stackoverflow.com/questions/2818503/callgrind-how-to-check-whether-a-line-executed-or-not

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!