Bug 1553972 - make --with-pgo-profile-path take a directory; r=nalexander

e10s profiling or IR-based PGO instrumentation will both produce
multiple `.profraw` files that need to be handled in some way.  Since
clang's `-fprofile-generate` option takes a directory, it seems fitting
to make `--with-pgo-profile-path` mirror that by taking a directory, and
letting `merge_profdata.py` deal with whatever files it might find in
said directory.

Differential Revision: https://phabricator.services.mozilla.com/D32389

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nathan Froyd 2019-05-24 01:53:59 +00:00
Родитель fd36809417
Коммит 93a44ee14e
6 изменённых файлов: 19 добавлений и 7 удалений

Просмотреть файл

@ -10,7 +10,7 @@ ac_add_options --with-branding=browser/branding/aurora
export MOZ_LTO=1
ac_add_options --enable-profile-use
ac_add_options --with-pgo-jarlog=/builds/worker/fetches/en-US.log
ac_add_options --with-pgo-profile-path=/builds/worker/fetches/default.profraw
ac_add_options --with-pgo-profile-path=/builds/worker/fetches
# Enable MOZ_ALLOW_LEGACY_EXTENSIONS
ac_add_options "MOZ_ALLOW_LEGACY_EXTENSIONS=1"

Просмотреть файл

@ -3,4 +3,4 @@
export MOZ_LTO=1
ac_add_options --enable-profile-use
ac_add_options --with-pgo-jarlog=/builds/worker/fetches/en-US.log
ac_add_options --with-pgo-profile-path=/builds/worker/fetches/default.profraw
ac_add_options --with-pgo-profile-path=/builds/worker/fetches

Просмотреть файл

@ -2,10 +2,17 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import glob
import subprocess
import sys
import buildconfig
def main(_, profile_file):
def main(_, profile_dir):
profraw_files = glob.glob(profile_dir + '/*.profraw')
if not profraw_files:
print('Could not find any profraw files in ' + profile_dir)
sys.exit(1)
subprocess.check_call([buildconfig.substs['LLVM_PROFDATA'], 'merge',
'-o', 'merged.profdata', profile_file])
'-o', 'merged.profdata'] + profraw_files)

Просмотреть файл

@ -1470,7 +1470,7 @@ js_option('--enable-profile-use',
help='Use a generated profile during the build')
js_option('--with-pgo-profile-path',
help='Path to the (unmerged) profile path to use during the build',
help='Path to the directory with unmerged profile data to use during the build',
nargs=1)
imply_option('MOZ_PGO',
@ -1481,6 +1481,7 @@ set_config('MOZ_PROFILE_USE',
@depends('--with-pgo-profile-path', '--enable-profile-use', 'LLVM_PROFDATA')
@imports('os')
def pgo_profile_path(path, pgo_use, profdata):
if not path:
return
@ -1488,6 +1489,10 @@ def pgo_profile_path(path, pgo_use, profdata):
die('Pass --enable-profile-use to use --with-pgo-profile-path.')
if path and not profdata:
die('LLVM_PROFDATA must be set to process the pgo profile.')
if not os.path.isdir(path[0]):
die('Argument to --with-pgo-profile-path must be a directory.')
if not os.path.isabs(path[0]):
die('Argument to --with-pgo-profile-path must be an absolute path.')
return path[0]

Просмотреть файл

@ -7,4 +7,4 @@ ac_add_options --enable-profile-use
# This is disabled because jarlog re-ordering breaks apk publishing tasks,
# see bug 1539933.
# ac_add_options --with-pgo-jarlog=/builds/worker/fetches/en-US.log
ac_add_options --with-pgo-profile-path=/builds/worker/fetches/default.profraw
ac_add_options --with-pgo-profile-path=/builds/worker/fetches

Просмотреть файл

@ -8,4 +8,4 @@ ac_add_options --enable-profile-use
# see bug 1539933.
# ac_add_options --with-pgo-jarlog=/builds/worker/fetches/en-US.log
ac_add_options --with-pgo-profile-path=/builds/worker/fetches/default.profraw
ac_add_options --with-pgo-profile-path=/builds/worker/fetches