Commit d6bfcb75 authored by Matthew Cary's avatar Matthew Cary Committed by Commit Bot

Orderfile: add option to build for monochrome.

This is helpful for local testing, where our older devices are getting flaky,
and will eventually be necessary when the bot upgrades.

Bug: 758566
Change-Id: If1d36f17c3ffd8605d14ab1aa30d4df0acafc3ad
Reviewed-on: https://chromium-review.googlesource.com/1219688Reviewed-by: default avatarEgor Pasko <pasko@chromium.org>
Reviewed-by: default avatarBenoit L <lizeb@chromium.org>
Commit-Queue: Matthew Cary <mattcary@chromium.org>
Cr-Commit-Position: refs/heads/master@{#591322}
parent 5ec934e8
...@@ -228,7 +228,7 @@ class ClankCompiler(object): ...@@ -228,7 +228,7 @@ class ClankCompiler(object):
"""Handles compilation of clank.""" """Handles compilation of clank."""
def __init__(self, out_dir, step_recorder, arch, jobs, max_load, use_goma, def __init__(self, out_dir, step_recorder, arch, jobs, max_load, use_goma,
goma_dir, system_health_profiling): goma_dir, system_health_profiling, monochrome):
self._out_dir = out_dir self._out_dir = out_dir
self._step_recorder = step_recorder self._step_recorder = step_recorder
self._arch = arch self._arch = arch
...@@ -237,12 +237,20 @@ class ClankCompiler(object): ...@@ -237,12 +237,20 @@ class ClankCompiler(object):
self._use_goma = use_goma self._use_goma = use_goma
self._goma_dir = goma_dir self._goma_dir = goma_dir
self._system_health_profiling = system_health_profiling self._system_health_profiling = system_health_profiling
if monochrome:
self._apk = 'Monochrome.apk'
self._libname = 'libmonochrome'
self._libchrome_target = 'monochrome'
else:
self._apk = 'Chrome.apk'
self._libname = 'libchrome'
self._libchrome_target = 'libchrome'
self.obj_dir = os.path.join(self._out_dir, 'Release', 'obj') self.obj_dir = os.path.join(self._out_dir, 'Release', 'obj')
self.lib_chrome_so = os.path.join( self.lib_chrome_so = os.path.join(
self._out_dir, 'Release', 'lib.unstripped', 'libchrome.so') self._out_dir, 'Release', 'lib.unstripped',
self.chrome_apk = os.path.join( '{}.so'.format(self._libname))
self._out_dir, 'Release', 'apks', 'Chrome.apk') self.chrome_apk = os.path.join(self._out_dir, 'Release', 'apks', self._apk)
def Build(self, instrumented, target): def Build(self, instrumented, target):
"""Builds the provided ninja target with or without order_profiling on. """Builds the provided ninja target with or without order_profiling on.
...@@ -302,7 +310,7 @@ class ClankCompiler(object): ...@@ -302,7 +310,7 @@ class ClankCompiler(object):
""" """
if force_relink: if force_relink:
self._step_recorder.RunCommand(['rm', '-rf', self.lib_chrome_so]) self._step_recorder.RunCommand(['rm', '-rf', self.lib_chrome_so])
self.Build(instrumented, 'libchrome') self.Build(instrumented, self._libchrome_target)
class OrderfileUpdater(object): class OrderfileUpdater(object):
...@@ -694,7 +702,8 @@ class OrderfileGenerator(object): ...@@ -694,7 +702,8 @@ class OrderfileGenerator(object):
self._instrumented_out_dir, self._instrumented_out_dir,
self._step_recorder, self._options.arch, self._options.jobs, self._step_recorder, self._options.arch, self._options.jobs,
self._options.max_load, self._options.use_goma, self._options.max_load, self._options.use_goma,
self._options.goma_dir, self._options.system_health_orderfile) self._options.goma_dir, self._options.system_health_orderfile,
self._options.monochrome)
self._compiler.CompileChromeApk(True) self._compiler.CompileChromeApk(True)
self._GenerateAndProcessProfile() self._GenerateAndProcessProfile()
self._MaybeArchiveOrderfile(self._GetUnpatchedOrderfileFilename()) self._MaybeArchiveOrderfile(self._GetUnpatchedOrderfileFilename())
...@@ -727,7 +736,7 @@ class OrderfileGenerator(object): ...@@ -727,7 +736,7 @@ class OrderfileGenerator(object):
self._uninstrumented_out_dir, self._step_recorder, self._uninstrumented_out_dir, self._step_recorder,
self._options.arch, self._options.jobs, self._options.max_load, self._options.arch, self._options.jobs, self._options.max_load,
self._options.use_goma, self._options.goma_dir, self._options.use_goma, self._options.goma_dir,
self._options.system_health_orderfile) self._options.system_health_orderfile, self._options.monochrome)
self._compiler.CompileLibchrome(False) self._compiler.CompileLibchrome(False)
self._PatchOrderfile() self._PatchOrderfile()
# Because identical code folding is a bit different with and without # Because identical code folding is a bit different with and without
...@@ -807,6 +816,9 @@ def CreateArgumentParser(): ...@@ -807,6 +816,9 @@ def CreateArgumentParser():
help=('Create an orderfile based on system health ' help=('Create an orderfile based on system health '
'benchmarks.'), 'benchmarks.'),
default=False) default=False)
parser.add_argument('--monochrome', action='store_true',
help=('Compile and instrument monochrome (for post-N '
'devices).'))
parser.add_argument('--offsets-for-memory', action='store_true', parser.add_argument('--offsets-for-memory', action='store_true',
help=('Favor memory savings in the orderfile. Used ' help=('Favor memory savings in the orderfile. Used '
'with --system-health-orderfile.'), 'with --system-health-orderfile.'),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment