如何在g ++中使用配置文件引导优化? [英] How to use profile guided optimizations in g++?

查看:328
本文介绍了如何在g ++中使用配置文件引导优化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此外,任何人都可以指点我的主题的一个很好的教程?我找不到任何。

Also, can anyone point me to a good tutorial on the subject? I can't find any.

推荐答案

-fprofile-generate将使用分析代码来测试应用程序。应用程序将在实际运行时记录某些可以提高性能的事件,如果此使用模式在编译时已知。分支,内联的可能性等,都可以记录,但我不知道GCC如何实现这一点。

-fprofile-generate will instrument the application with profiling code. The application will, while actually running, log certain events that could improve performance if this usage pattern was known at compile time. Branches, possibility for inlining, etc, can all be logged, but I'm not sure in detail how GCC implements this.

程序退出后,它会将所有这些数据转储到* .gcda文件中,这些文件本质上是测试运行的日志数据。在使用-fprofile-use标志重建应用程序后,GCC在进行优化时会考虑* .gcda日志数据,通常会显着提高性能。当然,这取决于很多因素。

After the program exits, it will dump all this data into *.gcda files, which are essentially log data for a test run. After rebuilding the application with -fprofile-use flag, GCC will take the *.gcda log data into account when doing its optimizations, usually increasing the performance significantly. Of course, this depends on many factors.

这篇关于如何在g ++中使用配置文件引导优化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆