Flutter Engine
The Flutter Engine
Functions | Variables
perf Namespace Reference

Functions

def perf_steps (api)
 
def RunSteps (api)
 
def GenTests (api)
 

Variables

string PYTHON_VERSION_COMPATIBILITY = "PY3"
 
list DEPS
 
list TEST_BUILDERS
 

Function Documentation

◆ GenTests()

def perf.GenTests (   api)

Definition at line 124 of file perf.py.

124def GenTests(api):
125 for builder in TEST_BUILDERS:
126 props = dict(
127 buildername=builder,
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',
133 resources='true',
134 revision='abc123',
135 swarm_out_dir='[SWARM_OUT_DIR]'
136 )
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'
147 test = (
148 api.test(builder) +
149 api.properties(**props) +
150 api.path.exists(
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',
155 'skp', 'VERSION'),
156 ) +
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'))
161 )
162 if 'Win' in builder:
163 test += api.platform('win', 64)
164
165 yield test
def GenTests(api)
Definition: perf.py:124

◆ perf_steps()

def perf.perf_steps (   api)
Run Skia benchmarks.

Definition at line 31 of file perf.py.

31def perf_steps(api):
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'
39
40 api.flavor.install(
41 resources=resources,
42 skps=skps,
43 images=images,
44 svgs=svgs,
45 texttraces=texttraces,
46 )
47
48 if do_upload:
49 api.flavor.create_clean_device_dir(
50 api.flavor.device_dirs.perf_data_dir)
51
52 # Find nanobench flags.
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
57 if do_upload:
58 args.append('--properties')
59 # Map iteration order is arbitrary; in order to maintain a consistent step
60 # ordering, sort by key.
61 for k in sorted(props.keys()):
62 v = props[k]
63 if v == '${SWARMING_BOT_ID}':
64 v = swarming_bot_id
65 elif v == '${SWARMING_TASK_ID}':
66 v = swarming_task_id
67 if v != '':
68 args.extend([k, v])
69
70 # Paths to required resources.
71 if resources:
72 args.extend(['-i', api.flavor.device_dirs.resource_dir])
73 if skps:
74 args.extend(['--skps', api.flavor.device_dirs.skp_dir]),
75 if images:
76 args.extend(['--images', api.flavor.device_path_join(
77 api.flavor.device_dirs.images_dir, 'nanobench')])
78 if texttraces:
79 assert api.flavor.device_dirs.texttraces_dir
80 args.extend(['--texttraces', api.flavor.device_dirs.texttraces_dir])
81 if svgs:
82 args.extend(['--svgs', api.flavor.device_dirs.svg_dir])
83 if do_upload:
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])
90
91 api.run(api.flavor.step, 'nanobench', cmd=args,
92 abort_on_failure=False)
93
94 # Copy results to swarming out dir.
95 if do_upload:
96 api.file.ensure_directory(
97 'makedirs perf_dir',
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)
102
103
def perf_steps(api)
Definition: perf.py:31

◆ RunSteps()

def perf.RunSteps (   api)

Definition at line 104 of file perf.py.

104def RunSteps(api):
105 api.vars.setup()
106 api.file.ensure_directory('makedirs tmp_dir', api.vars.tmp_dir)
107 api.flavor.setup('nanobench')
108
109 try:
110 perf_steps(api)
111 finally:
112 api.flavor.cleanup_steps()
113 api.run.check_failure()
114
115
def RunSteps(api)
Definition: perf.py:104

Variable Documentation

◆ DEPS

list perf.DEPS
Initial value:
1= [
2 'env',
3 'flavor',
4 'recipe_engine/file',
5 'recipe_engine/json',
6 'recipe_engine/path',
7 'recipe_engine/platform',
8 'recipe_engine/properties',
9 'recipe_engine/raw_io',
10 'recipe_engine/step',
11 'recipe_engine/time',
12 'run',
13 'vars',
14]

Definition at line 15 of file perf.py.

◆ PYTHON_VERSION_COMPATIBILITY

string perf.PYTHON_VERSION_COMPATIBILITY = "PY3"

Definition at line 13 of file perf.py.

◆ TEST_BUILDERS

list perf.TEST_BUILDERS
Initial value:
1= [
2 'Perf-Android-Clang-Nexus7-CPU-Tegra3-arm-Debug-All-Android',
3 ('Perf-Ubuntu18-Clang-Golo-GPU-QuadroP400-x86_64-Release-All'
4 '-Valgrind_SK_CPU_LIMIT_SSE41'),
5 'Perf-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Release-All-ANGLE',
6]

Definition at line 116 of file perf.py.