2016-07-26 18:52:17 +00:00
|
|
|
# Copyright 2016 The Chromium Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
|
|
|
|
|
|
|
# Recipe module for Skia Swarming perf.
|
|
|
|
|
|
|
|
|
2017-04-10 12:19:10 +00:00
|
|
|
import calendar
|
2020-03-02 19:46:09 +00:00
|
|
|
import json
|
2017-10-12 16:21:47 +00:00
|
|
|
import os
|
2017-04-10 12:19:10 +00:00
|
|
|
|
|
|
|
|
2016-07-26 18:52:17 +00:00
|
|
|
DEPS = [
|
2017-04-24 17:22:56 +00:00
|
|
|
'env',
|
|
|
|
'flavor',
|
2017-07-07 21:36:58 +00:00
|
|
|
'recipe_engine/file',
|
2017-04-10 12:19:10 +00:00
|
|
|
'recipe_engine/json',
|
2016-07-26 18:52:17 +00:00
|
|
|
'recipe_engine/path',
|
|
|
|
'recipe_engine/platform',
|
|
|
|
'recipe_engine/properties',
|
|
|
|
'recipe_engine/raw_io',
|
2017-04-10 12:19:10 +00:00
|
|
|
'recipe_engine/step',
|
|
|
|
'recipe_engine/time',
|
|
|
|
'run',
|
|
|
|
'vars',
|
2016-07-26 18:52:17 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
|
2017-04-10 12:19:10 +00:00
|
|
|
def perf_steps(api):
|
|
|
|
"""Run Skia benchmarks."""
|
2020-03-23 13:17:24 +00:00
|
|
|
do_upload = api.properties.get('do_upload') == 'true'
|
|
|
|
images = api.properties.get('images') == 'true'
|
|
|
|
resources = api.properties.get('resources') == 'true'
|
|
|
|
skps = api.properties.get('skps') == 'true'
|
|
|
|
svgs = api.properties.get('svgs') == 'true'
|
|
|
|
texttraces = api.properties.get('texttraces') == 'true'
|
|
|
|
|
|
|
|
api.flavor.install(
|
|
|
|
resources=resources,
|
|
|
|
skps=skps,
|
|
|
|
images=images,
|
|
|
|
svgs=svgs,
|
|
|
|
texttraces=texttraces,
|
|
|
|
)
|
|
|
|
|
|
|
|
if do_upload:
|
2017-04-10 12:19:10 +00:00
|
|
|
api.flavor.create_clean_device_dir(
|
|
|
|
api.flavor.device_dirs.perf_data_dir)
|
|
|
|
|
2020-03-02 19:32:29 +00:00
|
|
|
# Find nanobench flags.
|
2020-03-02 19:46:09 +00:00
|
|
|
args = json.loads(api.properties['nanobench_flags'])
|
|
|
|
props = json.loads(api.properties['nanobench_properties'])
|
2020-03-02 19:32:29 +00:00
|
|
|
swarming_bot_id = api.vars.swarming_bot_id
|
|
|
|
swarming_task_id = api.vars.swarming_task_id
|
2020-03-23 13:17:24 +00:00
|
|
|
if do_upload:
|
2020-03-02 19:32:29 +00:00
|
|
|
args.append('--properties')
|
|
|
|
# Map iteration order is arbitrary; in order to maintain a consistent step
|
|
|
|
# ordering, sort by key.
|
|
|
|
for k in sorted(props.keys()):
|
|
|
|
v = props[k]
|
|
|
|
if v == '${SWARMING_BOT_ID}':
|
|
|
|
v = swarming_bot_id
|
|
|
|
elif v == '${SWARMING_TASK_ID}':
|
|
|
|
v = swarming_task_id
|
|
|
|
if v != '':
|
|
|
|
args.extend([k, v])
|
|
|
|
|
|
|
|
# Paths to required resources.
|
2020-03-23 13:17:24 +00:00
|
|
|
if resources:
|
|
|
|
args.extend(['-i', api.flavor.device_dirs.resource_dir])
|
|
|
|
if skps:
|
2020-03-03 17:20:20 +00:00
|
|
|
args.extend(['--skps', api.flavor.device_dirs.skp_dir]),
|
2020-03-23 13:17:24 +00:00
|
|
|
if images:
|
2020-03-03 17:20:20 +00:00
|
|
|
args.extend(['--images', api.flavor.device_path_join(
|
|
|
|
api.flavor.device_dirs.images_dir, 'nanobench')])
|
2020-03-23 13:17:24 +00:00
|
|
|
if texttraces:
|
2020-03-02 19:32:29 +00:00
|
|
|
assert api.flavor.device_dirs.texttraces_dir
|
|
|
|
args.extend(['--texttraces', api.flavor.device_dirs.texttraces_dir])
|
2020-03-23 13:17:24 +00:00
|
|
|
if svgs:
|
2017-11-10 03:10:44 +00:00
|
|
|
args.extend(['--svgs', api.flavor.device_dirs.svg_dir])
|
2020-03-23 13:17:24 +00:00
|
|
|
if do_upload:
|
2017-04-10 12:19:10 +00:00
|
|
|
now = api.time.utcnow()
|
|
|
|
ts = int(calendar.timegm(now.utctimetuple()))
|
|
|
|
json_path = api.flavor.device_path_join(
|
|
|
|
api.flavor.device_dirs.perf_data_dir,
|
2018-05-18 11:36:55 +00:00
|
|
|
'nanobench_%s_%d.json' % (api.properties['revision'], ts))
|
2017-04-10 12:19:10 +00:00
|
|
|
args.extend(['--outResultsFile', json_path])
|
|
|
|
|
2020-03-02 19:32:29 +00:00
|
|
|
api.run(api.flavor.step, 'nanobench', cmd=args,
|
2017-10-02 14:48:32 +00:00
|
|
|
abort_on_failure=False)
|
2017-04-10 12:19:10 +00:00
|
|
|
|
|
|
|
# Copy results to swarming out dir.
|
2020-03-23 13:17:24 +00:00
|
|
|
if do_upload:
|
2018-05-18 11:36:55 +00:00
|
|
|
api.file.ensure_directory(
|
|
|
|
'makedirs perf_dir',
|
2018-06-20 17:23:16 +00:00
|
|
|
api.flavor.host_dirs.perf_data_dir)
|
2017-04-10 12:19:10 +00:00
|
|
|
api.flavor.copy_directory_contents_to_host(
|
|
|
|
api.flavor.device_dirs.perf_data_dir,
|
2018-05-18 11:36:55 +00:00
|
|
|
api.flavor.host_dirs.perf_data_dir)
|
2017-04-10 12:19:10 +00:00
|
|
|
|
|
|
|
|
2016-07-26 18:52:17 +00:00
|
|
|
def RunSteps(api):
|
2018-05-04 17:46:15 +00:00
|
|
|
api.vars.setup()
|
|
|
|
api.file.ensure_directory('makedirs tmp_dir', api.vars.tmp_dir)
|
2020-02-27 17:19:46 +00:00
|
|
|
api.flavor.setup('nanobench')
|
|
|
|
|
|
|
|
try:
|
|
|
|
perf_steps(api)
|
|
|
|
finally:
|
|
|
|
api.flavor.cleanup_steps()
|
|
|
|
api.run.check_failure()
|
2017-04-10 12:19:10 +00:00
|
|
|
|
|
|
|
|
2017-04-10 13:56:10 +00:00
|
|
|
TEST_BUILDERS = [
|
2019-03-28 13:32:14 +00:00
|
|
|
'Perf-Android-Clang-Nexus7-CPU-Tegra3-arm-Debug-All-Android',
|
2019-11-22 18:05:22 +00:00
|
|
|
('Perf-Ubuntu18-Clang-Golo-GPU-QuadroP400-x86_64-Release-All'
|
|
|
|
'-Valgrind_SK_CPU_LIMIT_SSE41'),
|
2018-04-19 19:49:18 +00:00
|
|
|
'Perf-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Release-All-ANGLE',
|
2017-04-10 13:56:10 +00:00
|
|
|
]
|
2016-07-26 18:52:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
def GenTests(api):
|
2017-04-10 13:56:10 +00:00
|
|
|
for builder in TEST_BUILDERS:
|
2020-03-23 13:17:24 +00:00
|
|
|
props = dict(
|
|
|
|
buildername=builder,
|
2021-01-29 16:05:41 +00:00
|
|
|
nanobench_flags='["nanobench","--example","--flags"]',
|
2020-03-23 13:17:24 +00:00
|
|
|
nanobench_properties=('{"key1":"value1","key2":"",'
|
|
|
|
'"bot":"${SWARMING_BOT_ID}",'
|
|
|
|
'"task":"${SWARMING_TASK_ID}"}'),
|
|
|
|
path_config='kitchen',
|
|
|
|
resources='true',
|
|
|
|
revision='abc123',
|
|
|
|
swarm_out_dir='[SWARM_OUT_DIR]'
|
|
|
|
)
|
|
|
|
if 'Valgrind' not in builder and 'Debug' not in builder:
|
|
|
|
props['do_upload'] = 'true'
|
|
|
|
if 'GPU' not in builder:
|
|
|
|
props['images'] = 'true'
|
|
|
|
if 'iOS' not in builder:
|
|
|
|
props['skps'] = 'true'
|
|
|
|
if 'Valgrind' not in builder:
|
|
|
|
props['svgs'] = 'true'
|
|
|
|
if 'Android' in builder and 'CPU' in builder:
|
|
|
|
props['texttraces'] = 'true'
|
2017-04-10 13:56:10 +00:00
|
|
|
test = (
|
|
|
|
api.test(builder) +
|
2020-03-23 13:17:24 +00:00
|
|
|
api.properties(**props) +
|
2017-04-10 13:56:10 +00:00
|
|
|
api.path.exists(
|
|
|
|
api.path['start_dir'].join('skia'),
|
|
|
|
api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
|
2017-04-10 12:19:10 +00:00
|
|
|
'skimage', 'VERSION'),
|
2017-04-10 13:56:10 +00:00
|
|
|
api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
|
2017-04-10 12:19:10 +00:00
|
|
|
'skp', 'VERSION'),
|
2017-04-10 13:56:10 +00:00
|
|
|
api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
|
2017-04-30 15:14:51 +00:00
|
|
|
) +
|
|
|
|
api.step_data('get swarming bot id',
|
|
|
|
stdout=api.raw_io.output('skia-bot-123')) +
|
|
|
|
api.step_data('get swarming task id',
|
|
|
|
stdout=api.raw_io.output('123456'))
|
2017-04-10 13:56:10 +00:00
|
|
|
)
|
|
|
|
if 'Win' in builder:
|
|
|
|
test += api.platform('win', 64)
|
2017-04-10 12:19:10 +00:00
|
|
|
|
2017-04-10 13:56:10 +00:00
|
|
|
yield test
|