在 g++ 中编译对于 gprof

发布于 2024-08-30 20:16:35 字数 174 浏览 1 评论 0原文

我不明白有关如何编译程序以使用 gprof 进行分析的 gprof 文档。在g++中,除了-pg选项之外,是否还需要使用-g选项(调试信息)进行编译。在每种情况下,我都会得到不同的结果,我想看看我的应用程序的瓶颈在发布模式下,而不是在调试模式下,其中编译器遗漏了许多优化(例如内联)

I do not understand the documentation for gprof regarding how to compile your program for profiling with gprof. In g++, is it required to compile with the -g option (debugging information) in a addition to the -pg option or not. In each case I get different results, and I would like to see where the bottlenecks in my application are in release mode, not in debug mode, where many optimizations are left out by the compiler (e.g. inlining)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

神爱温柔 2024-09-06 20:16:35

文档显示您可以执行任一操作,请注意您需要 -g用于逐行分析。因此,如果您想在发布条件下进行分析,并且可以接受不逐行执行,那么您应该能够在不使用 -g 的情况下进行编译。

The documentation shows that you can do either, noting that you need -g for line by line profiling. So if you want to profile under release conditions, and can accept not doing line-by-line, you should be able to compile without -g.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文