OLD | NEW |
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 set of web pages several times on a device, and extracts the | 7 """Loads a set of web pages several times on a device, and extracts the |
8 predictor database. | 8 predictor database. |
9 Also generates a WPR archive for another page. | 9 Also generates a WPR archive for another page. |
10 """ | 10 """ |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 sys.path.append(os.path.join(_SRC_PATH, 'tools', 'android', 'loading')) | 27 sys.path.append(os.path.join(_SRC_PATH, 'tools', 'android', 'loading')) |
28 import device_setup | 28 import device_setup |
29 from options import OPTIONS | 29 from options import OPTIONS |
30 import page_track | 30 import page_track |
31 | 31 |
32 import prefetch_predictor_common | 32 import prefetch_predictor_common |
33 | 33 |
34 | 34 |
35 _PAGE_LOAD_TIMEOUT = 40 | 35 _PAGE_LOAD_TIMEOUT = 40 |
| 36 _LEARNING_FLAGS = [ |
| 37 '--force-fieldtrials=trial/group', |
| 38 '--force-fieldtrial-params=trial.group:mode/learning', |
| 39 '--enable-features="SpeculativeResourcePrefetching<trial"'] |
36 | 40 |
37 | 41 |
38 def _CreateArgumentParser(): | 42 def _CreateArgumentParser(): |
39 """Creates and returns the argument parser.""" | 43 """Creates and returns the argument parser.""" |
40 parser = argparse.ArgumentParser( | 44 parser = argparse.ArgumentParser( |
41 ('Loads a set of web pages several times on a device, and extracts the ' | 45 ('Loads a set of web pages several times on a device, and extracts the ' |
42 'predictor database.'), parents=[OPTIONS.GetParentParser()]) | 46 'predictor database.'), parents=[OPTIONS.GetParentParser()]) |
43 parser.add_argument('--device', help='Device ID') | 47 parser.add_argument('--device', help='Device ID') |
44 parser.add_argument('--urls_filename', help='File containing a list of URLs ' | 48 parser.add_argument('--urls_filename', help='File containing a list of URLs ' |
45 '(one per line). URLs can be repeated.') | 49 '(one per line). URLs can be repeated.') |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 95 |
92 parser = _CreateArgumentParser() | 96 parser = _CreateArgumentParser() |
93 args = parser.parse_args() | 97 args = parser.parse_args() |
94 OPTIONS.SetParsedArgs(args) | 98 OPTIONS.SetParsedArgs(args) |
95 | 99 |
96 device = prefetch_predictor_common.FindDevice(args.device) | 100 device = prefetch_predictor_common.FindDevice(args.device) |
97 if device is None: | 101 if device is None: |
98 logging.error('Could not find device: %s.', args.device) | 102 logging.error('Could not find device: %s.', args.device) |
99 sys.exit(1) | 103 sys.exit(1) |
100 | 104 |
101 chrome_controller = prefetch_predictor_common.Setup( | 105 chrome_controller = prefetch_predictor_common.Setup(device, _LEARNING_FLAGS) |
102 device, ['--speculative-resource-prefetching=learning']) | |
103 _GenerateDatabase(chrome_controller, args.urls_filename, | 106 _GenerateDatabase(chrome_controller, args.urls_filename, |
104 args.output_filename, int(args.url_repeat)) | 107 args.output_filename, int(args.url_repeat)) |
105 _GenerateWprArchive(device, args.test_url, args.wpr_archive) | 108 _GenerateWprArchive(device, args.test_url, args.wpr_archive) |
106 | 109 |
107 | 110 |
108 if __name__ == '__main__': | 111 if __name__ == '__main__': |
109 main() | 112 main() |
OLD | NEW |