Loading...
Loading...
Compare original and translation side by side
-fprofile-generate-fprofile-use-O3-fprofile-generate-fprofile-use-O3Is -O3 -march=native already applied?
no → apply standard optimisation first
yes → is workload branch-heavy or has irregular call patterns?
yes → PGO will likely help 5-30%
no → PGO may not help; profile first with linux-perf是否已应用-O3 -march=native?
否 → 先应用标准优化
是 → 工作负载是否分支密集或调用模式不规则?
是 → PGO可能带来5-30%的性能提升
否 → PGO可能无效;先使用linux-perf进行剖面分析undefinedundefined
`-fprofile-correction`: handles profile count inconsistencies from parallel or nondeterministic runs. Always include it.
`-fprofile-correction`:处理并行或非确定性运行导致的剖面计数不一致问题,建议始终添加该参数。undefinedundefined
Clang's IR PGO is more accurate than GCC's and supports `SamplePGO` (sampling-based, no instrumentation overhead).
Clang的IR-based PGO比GCC的更准确,并且支持`SamplePGO`(基于采样,无插桩开销)。undefinedundefined
SamplePGO is ideal for production profiling without instrumentation overhead.
SamplePGO非常适合无需插桩开销的生产环境剖面分析。option(PGO_INSTRUMENT "Build with PGO instrumentation" OFF)
option(PGO_USE "Build with PGO profile data" OFF)
if(PGO_INSTRUMENT)
add_compile_options(-fprofile-instr-generate)
add_link_options(-fprofile-instr-generate)
endif()
if(PGO_USE)
add_compile_options(-fprofile-instr-use=${CMAKE_SOURCE_DIR}/prog.profdata)
add_link_options(-fprofile-instr-use=${CMAKE_SOURCE_DIR}/prog.profdata)
endif()undefinedoption(PGO_INSTRUMENT "Build with PGO instrumentation" OFF)
option(PGO_USE "Build with PGO profile data" OFF)
if(PGO_INSTRUMENT)
add_compile_options(-fprofile-instr-generate)
add_link_options(-fprofile-instr-generate)
endif()
if(PGO_USE)
add_compile_options(-fprofile-instr-use=${CMAKE_SOURCE_DIR}/prog.profdata)
add_link_options(-fprofile-instr-use=${CMAKE_SOURCE_DIR}/prog.profdata)
endif()undefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefined
For full workflow details and Clang vs GCC profile format notes, see [references/pgo-workflow.md](references/pgo-workflow.md).
有关完整工作流细节以及Clang与GCC剖面格式的说明,请参阅[references/pgo-workflow.md](references/pgo-workflow.md)。skills/compilers/gccskills/compilers/clangskills/profilers/linux-perfskills/profilers/flamegraphsskills/compilers/gccskills/compilers/clangskills/profilers/linux-perfskills/profilers/flamegraphs