Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Side by Side Diff: tools/android/customtabs_benchmark/scripts/customtabs_benchmark.py

Issue 2946913002: customtabs: Update the benchmark app for hidden tab benchmarking. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/android/customtabs_benchmark/java/src/org/chromium/customtabs/test/MainActivity.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # 2 #
3 # Copyright 2015 The Chromium Authors. All rights reserved. 3 # Copyright 2015 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Loops Custom Tabs tests and outputs the results into a CSV file.""" 7 """Loops Custom Tabs tests and outputs the results into a CSV file."""
8 8
9 import collections 9 import collections
10 import contextlib 10 import contextlib
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 191
192 Args: 192 Args:
193 filename: (str) file to process. 193 filename: (str) file to process.
194 194
195 Returns: 195 Returns:
196 A numpy structured array. 196 A numpy structured array.
197 """ 197 """
198 import numpy as np 198 import numpy as np
199 data = np.genfromtxt(filename, delimiter=',', skip_header=1) 199 data = np.genfromtxt(filename, delimiter=',', skip_header=1)
200 result = np.array(np.zeros(len(data)), 200 result = np.array(np.zeros(len(data)),
201 dtype=[('warmup', bool), ('speculation_mode', np.int32), 201 dtype=[('warmup', bool), ('speculation_mode', str),
202 ('delay_to_may_launch_url', np.int32), 202 ('delay_to_may_launch_url', np.int32),
203 ('delay_to_launch_url', np.int32), 203 ('delay_to_launch_url', np.int32),
204 ('commit', np.int32), ('plt', np.int32), 204 ('commit', np.int32), ('plt', np.int32),
205 ('first_contentful_paint', np.int32)]) 205 ('first_contentful_paint', np.int32)])
206 result['warmup'] = data[:, 0] 206 result['warmup'] = data[:, 0]
207 result['speculation_mode'] = data[:, 1] 207 result['speculation_mode'] = data[:, 1]
208 result['delay_to_may_launch_url'] = data[:, 2] 208 result['delay_to_may_launch_url'] = data[:, 2]
209 result['delay_to_launch_url'] = data[:, 3] 209 result['delay_to_launch_url'] = data[:, 3]
210 result['commit'] = data[:, 4] 210 result['commit'] = data[:, 4]
211 result['plt'] = data[:, 5] 211 result['plt'] = data[:, 5]
212 result['first_contentful_paint'] = data[:, 6] 212 result['first_contentful_paint'] = data[:, 6]
213 return result 213 return result
214 214
215 215
216 def _CreateOptionParser(): 216 def _CreateOptionParser():
217 parser = optparse.OptionParser(description='Loops Custom Tabs tests on a ' 217 parser = optparse.OptionParser(description='Loops Custom Tabs tests on a '
218 'device, and outputs the navigation timings ' 218 'device, and outputs the navigation timings '
219 'in a CSV file.') 219 'in a CSV file.')
220 parser.add_option('--device', help='Device ID') 220 parser.add_option('--device', help='Device ID')
221 parser.add_option('--url', help='URL to navigate to.', 221 parser.add_option('--url', help='URL to navigate to.',
222 default='https://www.android.com') 222 default='https://www.android.com')
223 parser.add_option('--warmup', help='Call warmup.', default=False, 223 parser.add_option('--warmup', help='Call warmup.', default=False,
224 action='store_true') 224 action='store_true')
225 parser.add_option('--speculation_mode', default='prerender', 225 parser.add_option('--speculation_mode', default='prerender',
226 help='The speculation mode (prerender, disabled, ' 226 help='The speculation mode (prerender, '
227 'speculative_prefetch or no_state_prefetch).', 227 'speculative_prefetch or no_state_prefetch).',
228 choices=['prerender', 'disabled', 'speculative_prefetch', 228 choices=['disabled', 'prerender', 'hidden_tab'])
229 'no_state_prefetch'])
230 parser.add_option('--delay_to_may_launch_url', 229 parser.add_option('--delay_to_may_launch_url',
231 help='Delay before calling mayLaunchUrl() in ms.', 230 help='Delay before calling mayLaunchUrl() in ms.',
232 type='int', default=1000) 231 type='int', default=1000)
233 parser.add_option('--delay_to_launch_url', 232 parser.add_option('--delay_to_launch_url',
234 help='Delay before calling launchUrl() in ms.', 233 help='Delay before calling launchUrl() in ms.',
235 type='int', default=-1) 234 type='int', default=-1)
236 parser.add_option('--cold', help='Purge the page cache before each run.', 235 parser.add_option('--cold', help='Purge the page cache before each run.',
237 default=False, action='store_true') 236 default=False, action='store_true')
238 parser.add_option('--output_file', help='Output file (append). "-" for ' 237 parser.add_option('--output_file', help='Output file (append). "-" for '
239 'stdout') 238 'stdout')
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 'delay_to_launch_url': options.delay_to_launch_url, 295 'delay_to_launch_url': options.delay_to_launch_url,
297 'cold': options.cold, 296 'cold': options.cold,
298 } 297 }
299 LoopOnDevice(device, [config], options.output_file, options.wpr_archive, 298 LoopOnDevice(device, [config], options.output_file, options.wpr_archive,
300 options.record, options.network_condition, options.wpr_log, 299 options.record, options.network_condition, options.wpr_log,
301 once=options.once) 300 once=options.once)
302 301
303 302
304 if __name__ == '__main__': 303 if __name__ == '__main__':
305 main() 304 main()
OLDNEW
« no previous file with comments | « tools/android/customtabs_benchmark/java/src/org/chromium/customtabs/test/MainActivity.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698