13PYTHON_VERSION_COMPATIBILITY =
"PY3"
21 'recipe_engine/platform',
22 'recipe_engine/properties',
23 'recipe_engine/raw_io',
32 """Run Skia benchmarks."""
33 do_upload = api.properties.get(
'do_upload') ==
'true'
34 images = api.properties.get(
'images') ==
'true'
35 resources = api.properties.get(
'resources') ==
'true'
36 skps = api.properties.get(
'skps') ==
'true'
37 svgs = api.properties.get(
'svgs') ==
'true'
38 texttraces = api.properties.get(
'texttraces') ==
'true'
45 texttraces=texttraces,
49 api.flavor.create_clean_device_dir(
50 api.flavor.device_dirs.perf_data_dir)
53 args = json.loads(api.properties[
'nanobench_flags'])
54 props = json.loads(api.properties[
'nanobench_properties'])
55 swarming_bot_id = api.vars.swarming_bot_id
56 swarming_task_id = api.vars.swarming_task_id
58 args.append(
'--properties')
61 for k
in sorted(props.keys()):
63 if v ==
'${SWARMING_BOT_ID}':
65 elif v ==
'${SWARMING_TASK_ID}':
72 args.extend([
'-i', api.flavor.device_dirs.resource_dir])
74 args.extend([
'--skps', api.flavor.device_dirs.skp_dir]),
76 args.extend([
'--images', api.flavor.device_path_join(
77 api.flavor.device_dirs.images_dir,
'nanobench')])
79 assert api.flavor.device_dirs.texttraces_dir
80 args.extend([
'--texttraces', api.flavor.device_dirs.texttraces_dir])
82 args.extend([
'--svgs', api.flavor.device_dirs.svg_dir])
84 now = api.time.utcnow()
85 ts =
int(calendar.timegm(now.utctimetuple()))
86 json_path = api.flavor.device_path_join(
87 api.flavor.device_dirs.perf_data_dir,
88 'nanobench_%s_%d.json' % (api.properties[
'revision'], ts))
89 args.extend([
'--outResultsFile', json_path])
91 api.run(api.flavor.step,
'nanobench', cmd=args,
92 abort_on_failure=
False)
96 api.file.ensure_directory(
98 api.flavor.host_dirs.perf_data_dir)
99 api.flavor.copy_directory_contents_to_host(
100 api.flavor.device_dirs.perf_data_dir,
101 api.flavor.host_dirs.perf_data_dir)
106 api.file.ensure_directory(
'makedirs tmp_dir', api.vars.tmp_dir)
107 api.flavor.setup(
'nanobench')
112 api.flavor.cleanup_steps()
113 api.run.check_failure()
117 'Perf-Android-Clang-Nexus7-CPU-Tegra3-arm-Debug-All-Android',
118 (
'Perf-Ubuntu18-Clang-Golo-GPU-QuadroP400-x86_64-Release-All'
119 '-Valgrind_SK_CPU_LIMIT_SSE41'),
120 'Perf-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Release-All-ANGLE',
125 for builder
in TEST_BUILDERS:
128 nanobench_flags=
'["nanobench","--example","--flags"]',
129 nanobench_properties=(
'{"key1":"value1","key2":"",'
130 '"bot":"${SWARMING_BOT_ID}",'
131 '"task":"${SWARMING_TASK_ID}"}'),
132 path_config=
'kitchen',
135 swarm_out_dir=
'[SWARM_OUT_DIR]'
137 if 'Valgrind' not in builder
and 'Debug' not in builder:
138 props[
'do_upload'] =
'true'
139 if 'GPU' not in builder:
140 props[
'images'] =
'true'
141 if 'iOS' not in builder:
142 props[
'skps'] =
'true'
143 if 'Valgrind' not in builder:
144 props[
'svgs'] =
'true'
145 if 'Android' in builder
and 'CPU' in builder:
146 props[
'texttraces'] =
'true'
149 api.properties(**props) +
151 api.path.start_dir.join(
'skia'),
152 api.path.start_dir.join(
'skia',
'infra',
'bots',
'assets',
153 'skimage',
'VERSION'),
154 api.path.start_dir.join(
'skia',
'infra',
'bots',
'assets',
157 api.step_data(
'get swarming bot id',
158 stdout=api.raw_io.output(
'skia-bot-123')) +
159 api.step_data(
'get swarming task id',
160 stdout=api.raw_io.output(
'123456'))
163 test += api.platform(
'win', 64)