michael@0: .. _pgo: michael@0: michael@0: =========================== michael@0: Profile Guided Optimization michael@0: =========================== michael@0: michael@0: :abbr:`PGO (Profile Guided Optimization)` is the process of adding michael@0: probes to a compiled binary, running said binary, then using the michael@0: run-time information to *recompile* the binary to (hopefully) make it michael@0: faster. michael@0: michael@0: How PGO Builds Work michael@0: =================== michael@0: michael@0: The supported interface for invoking a PGO build is to evaluate the michael@0: *build* target of client.mk with *MOZ_PGO* defined. e.g.:: michael@0: michael@0: $ make -f client.mk MOZ_PGO=1 michael@0: michael@0: This is equivalent to:: michael@0: michael@0: $ make -f client.mk profiledbuild michael@0: michael@0: Which is roughly equivalent to: michael@0: michael@0: #. Perform a build with *MOZ_PROFILE_GENERATE=1* and *MOZ_PGO_INSTRUMENTED=1* michael@0: #. Package with *MOZ_PGO_INSTRUMENTED=1* michael@0: #. Performing a run of the instrumented binaries michael@0: #. $ make maybe_clobber_profiledbuild michael@0: #. Perform a build with *MOZ_PROFILE_USE=1* michael@0: michael@0: Differences between toolchains michael@0: ============================== michael@0: michael@0: There are some implementation differences depending on the compiler michael@0: toolchain being used. michael@0: michael@0: The *maybe_clobber_profiledbuild* step gets its name because of a michael@0: difference. On Windows, this step merely moves some *.pgc* files around. michael@0: Using GCC or Clang, it is equivalent to a *make clean*.