插桩反馈优化场景
插桩反馈优化场景下,需要经过两次编译,第一次带编译选项-fprofile-generate[=path],经过一系列典型场景测试后生成profile数据,第二次带编译选项-fprofile-use[=path]编译优化版本,AutoBOLT会将插桩数据转换成BOLT profile,并自动使能链接后优化。
适用场景
不介意插桩阶段性能损耗,对构建和测试时间不敏感,追求极致性能等情况
使用方式
1 2 3 4 5 6 | # 插桩,生成gcno gcc -O3 -fprofile-generate[=path] -fprofile-update=atomic -o test test.c # 执行测试,获得gcda ./test # 使用生成的gcda数据编译生成新的可执行文件 gcc -O3 -fprofile-use[=path] -fprofile-correction -Wno-error=coverage-mismatch -Wno-error=missing-profile -fauto-bolt -fbolt-target=test_pgoed -o test_pgoed test.c |
父主题: AutoBOLT