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

Side by Side Diff: tools/resource_prefetch_predictor/prefetch_benchmark.py

Issue 2692993012: predictors: Fix prefetch benchmark. (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | 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 2016 The Chromium Authors. All rights reserved. 3 # Copyright 2016 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 """Loads a web page with speculative prefetch, and collects loading metrics.""" 7 """Loads a web page with speculative prefetch, and collects loading metrics."""
8 8
9 import argparse 9 import argparse
10 import logging 10 import logging
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 94
95 def _RunOnce(device, database_filename, url, prefetch_delay_ms, 95 def _RunOnce(device, database_filename, url, prefetch_delay_ms,
96 output_filename, wpr_archive, network_condition): 96 output_filename, wpr_archive, network_condition):
97 _Setup(device, database_filename) 97 _Setup(device, database_filename)
98 98
99 disable_prefetch = prefetch_delay_ms == -1 99 disable_prefetch = prefetch_delay_ms == -1
100 # Startup tracing to ease debugging. 100 # Startup tracing to ease debugging.
101 chrome_args = (customtabs_benchmark.CHROME_ARGS 101 chrome_args = (customtabs_benchmark.CHROME_ARGS
102 + ['--trace-startup', '--trace-startup-duration=20']) 102 + ['--trace-startup', '--trace-startup-duration=20'])
103 if not disable_prefetch:
104 chrome_args.append(_EXTERNAL_PREFETCH_FLAG)
105 103
106 chrome_controller = controller.RemoteChromeController(device) 104 chrome_controller = controller.RemoteChromeController(device)
107 device.ForceStop(OPTIONS.ChromePackage().package) 105 device.ForceStop(OPTIONS.ChromePackage().package)
108 chrome_controller.AddChromeArguments(chrome_args) 106 chrome_controller.AddChromeArguments(chrome_args)
109 107
110 with device_setup.RemoteWprHost( 108 with device_setup.RemoteWprHost(
111 device, wpr_archive, record=False, 109 device, wpr_archive, record=False,
112 network_condition_name=network_condition) as wpr: 110 network_condition_name=network_condition) as wpr:
113 logging.info('WPR arguments: ' + ' '.join(wpr.chrome_args)) 111 logging.info('WPR arguments: ' + ' '.join(wpr.chrome_args))
114 chrome_args += wpr.chrome_args 112 chrome_args += wpr.chrome_args
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 while True: 147 while True:
150 delay = delays[random.randint(0, len(delays) - 1)] 148 delay = delays[random.randint(0, len(delays) - 1)]
151 _RunOnce(device, args.database, args.url, delay, args.output_filename, 149 _RunOnce(device, args.database, args.url, delay, args.output_filename,
152 args.wpr_archive, args.network_condition) 150 args.wpr_archive, args.network_condition)
153 if args.once: 151 if args.once:
154 return 152 return
155 153
156 154
157 if __name__ == '__main__': 155 if __name__ == '__main__':
158 main() 156 main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698