如何让 callgrind 转储源行信息?
我正在尝试在 GNU/Linux 上分析一个进行实时音频处理的共享库,因此性能很重要。我运行另一个程序,将其连接到系统的音频输入和输出,并使用 callgrind 对其进行分析。
通过查看 KCacheGrind 中的结果,我获得了有关哪些函数占用了我大部分时间的重要信息。但是,它不会让我逐行查看信息,而是说我需要使用调试符号对其进行编译并再次运行分析。
我正在分析的程序不是用调试符号编译的,但库是用调试符号编译的。我知道这一点,因为有趣的是,cachegrind 的源代码注释工作得很好。
当我运行 callgrind 时,它说默认是转储源行信息,但它只是没有这样做。有什么方法可以强迫它这样做,或者找出阻止它的原因吗?
I'm trying to profile a shared library on GNU/Linux which does real-time audio processing, so performance is important. I run another program which hooks it up to the audio input and output of my system, and profile that with callgrind.
Looking at the results in KCacheGrind, I get great information about what functions are taking up most of my time. However, it won't let me look at the line by line information, and instead says I need to compile it with debugging symbols and run the profiling again.
The program which I am profiling is not compiled with debug symbols, but the library is. And I know this, because interestingly, source code annotations for cachegrind work fine.
When I run callgrind, it says the default is to dump source line information, but it just isn't doing that. Is there some way I could force it to, or figure out what's stopping it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否使用
--dump-instr=yes --trace-jump=yes
来获取指令级别信息?Are you using
--dump-instr=yes --trace-jump=yes
to get the instruction level information?正如您已正确识别的那样,默认情况下,
callgrind
正在源代码级别执行事件计数。引用
callgrind
的手册页 -但在后处理过程中,您必须使用
--include 为
选项用于生成带有逐行信息的带注释的源代码。callgrind_annotate
工具提供源文件的路径引用
callgrind_annotate
的手册页 -这是对我有用的示例命令 -
另请注意,源代码级别注释报告放置在通常的
file:function
文件中的摘要报告。因此,您必须滚动浏览报告中的内容才能找到它们。As you have correctly identified
callgrind
by default is performing the event count at source code level.Quoting from the man page of
callgrind
-But then during post-processing, you have to provide the path to source files for the
callgrind_annotate
tool using the--include
option for it to generate the annotated source-code with line by line information.Quoting from the man page of
callgrind_annotate
-This is the sample command that worked for me -
Also please note that the source-code level annotated report is placed after the usual
file:function
summary report in the file. So, you'll have to scroll past those in the report to reach them.