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)