Reland "android: Remove the legacy orderfile instrumentation."
This reverts commit 2b33f7e21ffa29e67a02d27161c0e03486287744.
Reason for reland: The initial CL wasn't related to
crbug.com/814627.
Original change's description:
> Revert "android: Remove the legacy orderfile instrumentation."
>
> This reverts commit 5ecdb8cf939ff1d3b53a34e45e283e0975ba8283.
>
> Reason for revert: Speculative revert for crbug.com/814627
>
> Original change's description:
> > android: Remove the legacy orderfile instrumentation.
> >
> > Bug: 813597
> > Change-Id: Ie4838ed3b816b483b3b44325f4159856c3b81d4e
> > Reviewed-on: https://chromium-review.googlesource.com/925424
> > Reviewed-by: Egor Pasko <pasko@chromium.org>
> > Reviewed-by: agrieve <agrieve@chromium.org>
> > Reviewed-by: Matthew Cary <mattcary@chromium.org>
> > Commit-Queue: Benoit L <lizeb@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#538082}
>
> TBR=pasko@chromium.org,agrieve@chromium.org,lizeb@chromium.org,mattcary@chromium.org
>
> Change-Id: I161ebcdaf105d561d4b4ad5ebb21a065ebc9be14
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: 813597
> Reviewed-on: https://chromium-review.googlesource.com/931381
> Reviewed-by: Tien-Ren Chen <trchen@chromium.org>
> Commit-Queue: Tien-Ren Chen <trchen@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#538414}
TBR=pasko@chromium.org,trchen@chromium.org,agrieve@chromium.org,lizeb@chromium.org,mattcary@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: 813597
Change-Id: I22daf61b6441336d9158124be3cc71959e426613
Reviewed-on: https://chromium-review.googlesource.com/951422
Reviewed-by: Benoit L <lizeb@chromium.org>
Reviewed-by: Egor Pasko <pasko@chromium.org>
Reviewed-by: Matthew Cary <mattcary@chromium.org>
Commit-Queue: Benoit L <lizeb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#541111}
diff --git a/tools/cygprofile/orderfile_generator_backend.py b/tools/cygprofile/orderfile_generator_backend.py
index 147a067..96348a5 100755
--- a/tools/cygprofile/orderfile_generator_backend.py
+++ b/tools/cygprofile/orderfile_generator_backend.py
@@ -250,7 +250,7 @@
"""Handles compilation of clank."""
def __init__(self, out_dir, step_recorder, arch, jobs, max_load, use_goma,
- goma_dir, lightweight_instrumentation):
+ goma_dir):
self._out_dir = out_dir
self._step_recorder = step_recorder
self._arch = arch
@@ -258,7 +258,6 @@
self._max_load = max_load
self._use_goma = use_goma
self._goma_dir = goma_dir
- self._lightweight_instrumentation = lightweight_instrumentation
lib_chrome_so_dir = 'lib.unstripped'
self.lib_chrome_so = os.path.join(
self._out_dir, 'Release', lib_chrome_so_dir, 'libchrome.so')
@@ -288,8 +287,6 @@
'use_goma=' + str(self._use_goma).lower(),
'use_order_profiling=' + str(instrumented).lower(),
]
- if instrumented and self._lightweight_instrumentation:
- args.append('use_lightweight_order_profiling=true')
if self._goma_dir:
args += ['goma_dir="%s"' % self._goma_dir]
@@ -420,8 +417,6 @@
generates an updated orderfile.
"""
_CLANK_REPO = os.path.join(constants.DIR_SOURCE_ROOT, 'clank')
- _MERGE_TRACES_SCRIPT = os.path.join(
- constants.DIR_SOURCE_ROOT, 'tools', 'cygprofile', 'mergetraces.py')
_CYGLOG_TO_ORDERFILE_SCRIPT = os.path.join(
constants.DIR_SOURCE_ROOT, 'tools', 'cygprofile',
'cyglog_to_orderfile.py')
@@ -460,18 +455,12 @@
if options.profile:
output_directory = os.path.join(self._instrumented_out_dir, 'Release')
host_cyglog_dir = os.path.join(output_directory, 'cyglog_data')
- # Only override the defaults when using lightweight instrumentation,
- # as the regular profiling code is likely too slow for these.
urls = [profile_android_startup.AndroidProfileTool.TEST_URL]
use_wpr = True
simulate_user = False
- if options.simulate_user and not options.lightweight_instrumentation:
- logging.error(
- '--simulate-user required --lightweight-instrumentation, ignoring.')
- if options.lightweight_instrumentation:
- urls = options.urls
- use_wpr = not options.no_wpr
- simulate_user = options.simulate_user
+ urls = options.urls
+ use_wpr = not options.no_wpr
+ simulate_user = options.simulate_user
self._profiler = profile_android_startup.AndroidProfileTool(
output_directory, host_cyglog_dir, use_wpr, urls, simulate_user)
@@ -486,27 +475,6 @@
assert os.path.isdir(constants.DIR_SOURCE_ROOT), 'No src directory found'
symbol_extractor.SetArchitecture(options.arch)
- def _RunCygprofileUnitTests(self):
- """Builds, deploys and runs cygprofile_unittests."""
- # There an no unittests (yet) for the lightweight instrumentation.
- # TODO(lizeb): Fix this.
- if self._options.lightweight_instrumentation:
- return
- tools_compiler = ClankCompiler(
- os.path.dirname(constants.GetOutDirectory()),
- self._step_recorder, self._options.arch, self._options.jobs,
- self._options.max_load, self._options.use_goma, self._options.goma_dir,
- self._options.lightweight_instrumentation)
- tools_compiler.Build(instrumented=False, target='android_tools')
- self._compiler.Build(instrumented=True, target='cygprofile_unittests')
-
- self._step_recorder.BeginStep('Deploy and run cygprofile_unittests')
- exit_code = self._profiler.RunCygprofileTests()
-
- if exit_code != 0:
- self._step_recorder.FailStep(
- 'cygprofile_unittests exited with non-0 status: %d' % exit_code)
-
@staticmethod
def _RemoveBlanks(src_file, dest_file):
"""A utility to remove blank lines from a file.
@@ -537,20 +505,14 @@
self._compiler.chrome_apk,
constants.PACKAGE_INFO['chrome'])
self._step_recorder.BeginStep('Process cyglog')
- if self._options.lightweight_instrumentation:
- assert os.path.exists(self._compiler.lib_chrome_so)
- offsets = process_profiles.GetReachedOffsetsFromDumpFiles(
- files, self._compiler.lib_chrome_so)
- if not offsets:
- raise Exception('No profiler offsets found in {}'.format(
- '\n'.join(files)))
- with open(self._MERGED_CYGLOG_FILENAME, 'w') as f:
- f.write('\n'.join(map(str, offsets)))
- else:
- with open(self._MERGED_CYGLOG_FILENAME, 'w') as merged_cyglog:
- self._step_recorder.RunCommand([self._MERGE_TRACES_SCRIPT] + files,
- constants.DIR_SOURCE_ROOT,
- stdout=merged_cyglog)
+ assert os.path.exists(self._compiler.lib_chrome_so)
+ offsets = process_profiles.GetReachedOffsetsFromDumpFiles(
+ files, self._compiler.lib_chrome_so)
+ if not offsets:
+ raise Exception('No profiler offsets found in {}'.format(
+ '\n'.join(files)))
+ with open(self._MERGED_CYGLOG_FILENAME, 'w') as f:
+ f.write('\n'.join(map(str, offsets)))
except Exception:
for f in files:
self._SaveForDebugging(f)
@@ -564,10 +526,7 @@
'--target-arch=' + self._options.arch,
'--native-library=' + self._compiler.lib_chrome_so,
'--output=' + self._GetUnpatchedOrderfileFilename()]
- if self._options.lightweight_instrumentation:
- command_args.append('--reached-offsets=' + self._MERGED_CYGLOG_FILENAME)
- else:
- command_args.append('--merged-cyglog=' + self._MERGED_CYGLOG_FILENAME)
+ command_args.append('--reached-offsets=' + self._MERGED_CYGLOG_FILENAME)
self._step_recorder.RunCommand(
[self._CYGLOG_TO_ORDERFILE_SCRIPT] + command_args)
except CommandError:
@@ -688,13 +647,9 @@
self._instrumented_out_dir,
self._step_recorder, self._options.arch, self._options.jobs,
self._options.max_load, self._options.use_goma,
- self._options.goma_dir,
- self._options.lightweight_instrumentation)
- self._RunCygprofileUnitTests()
- if self._options.lightweight_instrumentation:
- _EnsureOrderfileStartsWithAnchorSection(self._GetPathToOrderfile())
- self._compiler.CompileChromeApk(
- True, self._options.lightweight_instrumentation)
+ self._options.goma_dir)
+ _EnsureOrderfileStartsWithAnchorSection(self._GetPathToOrderfile())
+ self._compiler.CompileChromeApk(True)
self._GenerateAndProcessProfile()
self._MaybeArchiveOrderfile(self._GetUnpatchedOrderfileFilename())
profile_uploaded = True
@@ -710,8 +665,7 @@
self._compiler = ClankCompiler(
self._uninstrumented_out_dir, self._step_recorder,
self._options.arch, self._options.jobs, self._options.max_load,
- self._options.use_goma, self._options.goma_dir,
- self._options.lightweight_instrumentation)
+ self._options.use_goma, self._options.goma_dir)
self._compiler.CompileLibchrome(False)
self._PatchOrderfile()
# Because identical code folding is a bit different with and without
@@ -748,10 +702,6 @@
"""Creates and returns the argument parser."""
parser = argparse.ArgumentParser()
parser.add_argument(
- '--regular-instrumentation', action='store_false',
- dest='lightweight_instrumentation',
- help='Use the regular instrumentation path')
- parser.add_argument(
'--buildbot', action='store_true',
help='If true, the script expects to be run on a buildbot')
parser.add_argument(