Only download r8.jar once when benchmarking
Change-Id: I0492ad2131c9977ae457794b5f47cfa46a99e69d
diff --git a/tools/historic_run.py b/tools/historic_run.py
index 5d6f8d5..55e5792 100755
--- a/tools/historic_run.py
+++ b/tools/historic_run.py
@@ -149,7 +149,7 @@
count = 0
for index in commit_permutations:
count += 1
- print('Running commit %s out of %s' % (count, len(commits)))
+ print('\nRunning commit %s out of %s' % (count, len(commits)))
commit = commits[index]
if not utils.cloud_storage_exists(commit.destination):
# We may have a directory, but no r8.jar
@@ -190,6 +190,7 @@
time_commit = '%s_%s' % (commit.timestamp, commit.git_hash)
time_commit_path = os.path.join(output_path, time_commit)
print(' '.join(cmd))
+ status = None
if not options.dry_run:
if not os.path.exists(time_commit_path):
os.makedirs(time_commit_path)
@@ -206,7 +207,12 @@
process.kill()
print("Task timed out")
stderr.write("timeout\n")
- print('Wrote outputs to: %s' % time_commit_path)
+ status = 'TIMED OUT'
+ else:
+ returncode = process.returncode
+ status = 'SUCCESS' if returncode == 0 else f'FAILED ({returncode})'
+ print(f'Wrote outputs to: {time_commit_path}')
+ print(status)
def main(argv):
diff --git a/tools/perf.py b/tools/perf.py
index 212f5f5..da0ba78 100755
--- a/tools/perf.py
+++ b/tools/perf.py
@@ -4,6 +4,7 @@
# BSD-style license that can be found in the LICENSE file.
import argparse
+import compiledump
import json
import os
import shutil
@@ -121,6 +122,12 @@
def main():
options, args = ParseOptions()
with utils.TempDir() as temp:
+ if options.version:
+ # Download r8.jar once instead of once per run_benchmark.py invocation.
+ download_options = argparse.Namespace(no_build=True, nolib=True)
+ r8jar = compiledump.download_distribution(options.version,
+ download_options, temp)
+
for app in options.apps:
if options.skip_if_output_exists:
if options.outdir:
@@ -139,7 +146,10 @@
if options.verbose:
base_cmd.append('--verbose')
if options.version:
- base_cmd.extend(['--version', options.version, '--nolib'])
+ base_cmd.extend([
+ '--version', options.version, '--version-jar', r8jar,
+ '--nolib'
+ ])
# Build
utils.Print(f'Preparing {app}', quiet=options.quiet)
diff --git a/tools/run_benchmark.py b/tools/run_benchmark.py
index dd05251..6bf0882 100755
--- a/tools/run_benchmark.py
+++ b/tools/run_benchmark.py
@@ -78,6 +78,10 @@
'-v',
help='Use R8 version/hash for the run (default local build)',
default=None)
+ result.add_argument(
+ '--version-jar',
+ help='The r8.jar corresponding to the version given at --version.',
+ default=None)
result.add_argument('--temp',
help='A directory to use for temporaries and outputs.',
default=None)
@@ -130,11 +134,11 @@
os.path.join(utils.R8LIB_TESTBASE_JAR)
]
- if options.version:
+ if options.version or options.version_jar:
# r8 is downloaded so only test jar needs to be built.
buildTargets = testBuildTargets
- r8jar = compiledump.download_distribution(options.version, options,
- temp)
+ r8jar = options.version_jar or compiledump.download_distribution(
+ options.version, options, temp)
if not options.no_build:
gradle.RunGradle(buildTargets + ['-Pno_internal'])