OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Archives or replays webpages and creates SKPs in a Google Storage location. | 6 """Archives or replays webpages and creates SKPs in a Google Storage location. |
7 | 7 |
8 To archive webpages and store SKP files (archives should be rarely updated): | 8 To archive webpages and store SKP files (archives should be rarely updated): |
9 | 9 |
10 cd skia | 10 cd skia |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 self._skp_prefix = parse_options.skp_prefix | 156 self._skp_prefix = parse_options.skp_prefix |
157 data_store_location = parse_options.data_store | 157 data_store_location = parse_options.data_store |
158 if data_store_location.startswith(gs_utils.GS_PREFIX): | 158 if data_store_location.startswith(gs_utils.GS_PREFIX): |
159 self.gs = GoogleStorageDataStore(data_store_location) | 159 self.gs = GoogleStorageDataStore(data_store_location) |
160 else: | 160 else: |
161 self.gs = LocalFileSystemDataStore(data_store_location) | 161 self.gs = LocalFileSystemDataStore(data_store_location) |
162 self._upload_to_partner_bucket = parse_options.upload_to_partner_bucket | 162 self._upload_to_partner_bucket = parse_options.upload_to_partner_bucket |
163 self._alternate_upload_dir = parse_options.alternate_upload_dir | 163 self._alternate_upload_dir = parse_options.alternate_upload_dir |
164 self._telemetry_binaries_dir = os.path.join(parse_options.chrome_src_path, | 164 self._telemetry_binaries_dir = os.path.join(parse_options.chrome_src_path, |
165 'tools', 'perf') | 165 'tools', 'perf') |
| 166 self._catapult_dir = os.path.join(parse_options.chrome_src_path, |
| 167 'third_party', 'catapult') |
166 | 168 |
167 self._local_skp_dir = os.path.join( | 169 self._local_skp_dir = os.path.join( |
168 parse_options.output_dir, ROOT_PLAYBACK_DIR_NAME, SKPICTURES_DIR_NAME) | 170 parse_options.output_dir, ROOT_PLAYBACK_DIR_NAME, SKPICTURES_DIR_NAME) |
169 self._local_record_webpages_archive_dir = os.path.join( | 171 self._local_record_webpages_archive_dir = os.path.join( |
170 parse_options.output_dir, ROOT_PLAYBACK_DIR_NAME, 'webpages_archive') | 172 parse_options.output_dir, ROOT_PLAYBACK_DIR_NAME, 'webpages_archive') |
171 | 173 |
172 # List of SKP files generated by this script. | 174 # List of SKP files generated by this script. |
173 self._skp_files = [] | 175 self._skp_files = [] |
174 | 176 |
175 def _ParsePageSets(self, page_sets): | 177 def _ParsePageSets(self, page_sets): |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 page_set_json_name = page_set_basename + '.json' | 246 page_set_json_name = page_set_basename + '.json' |
245 wpr_data_file = page_set.split(os.path.sep)[-1].split('.')[0] + '_000.wpr' | 247 wpr_data_file = page_set.split(os.path.sep)[-1].split('.')[0] + '_000.wpr' |
246 page_set_dir = os.path.dirname(page_set) | 248 page_set_dir = os.path.dirname(page_set) |
247 | 249 |
248 if self._IsChromiumPageSet(page_set): | 250 if self._IsChromiumPageSet(page_set): |
249 print 'Using Chromium\'s captured archives for Chromium\'s page sets.' | 251 print 'Using Chromium\'s captured archives for Chromium\'s page sets.' |
250 elif self._record: | 252 elif self._record: |
251 # Create an archive of the specified webpages if '--record=True' is | 253 # Create an archive of the specified webpages if '--record=True' is |
252 # specified. | 254 # specified. |
253 record_wpr_cmd = ( | 255 record_wpr_cmd = ( |
254 'PYTHONPATH=%s:$PYTHONPATH' % page_set_dir, | 256 'PYTHONPATH=%s:%s:$PYTHONPATH' % (page_set_dir, self._catapult_dir), |
255 'DISPLAY=%s' % X11_DISPLAY, | 257 'DISPLAY=%s' % X11_DISPLAY, |
256 os.path.join(self._telemetry_binaries_dir, 'record_wpr'), | 258 os.path.join(self._telemetry_binaries_dir, 'record_wpr'), |
257 '--extra-browser-args="%s"' % self._browser_args, | 259 '--extra-browser-args="%s"' % self._browser_args, |
258 '--browser=exact', | 260 '--browser=exact', |
259 '--browser-executable=%s' % self._browser_executable, | 261 '--browser-executable=%s' % self._browser_executable, |
260 '%s_page_set' % page_set_basename, | 262 '%s_page_set' % page_set_basename, |
261 '--page-set-base-dir=%s' % page_set_dir | 263 '--page-set-base-dir=%s' % page_set_dir |
262 ) | 264 ) |
263 for _ in range(RETRY_RECORD_WPR_COUNT): | 265 for _ in range(RETRY_RECORD_WPR_COUNT): |
264 try: | 266 try: |
(...skipping 17 matching lines...) Expand all Loading... |
282 else: | 284 else: |
283 # If we get here then record_wpr did not succeed and thus did not | 285 # If we get here then record_wpr did not succeed and thus did not |
284 # break out of the loop. | 286 # break out of the loop. |
285 raise Exception('record_wpr failed for page_set: %s' % page_set) | 287 raise Exception('record_wpr failed for page_set: %s' % page_set) |
286 | 288 |
287 else: | 289 else: |
288 # Get the webpages archive so that it can be replayed. | 290 # Get the webpages archive so that it can be replayed. |
289 self._DownloadWebpagesArchive(wpr_data_file, page_set_json_name) | 291 self._DownloadWebpagesArchive(wpr_data_file, page_set_json_name) |
290 | 292 |
291 run_benchmark_cmd = ( | 293 run_benchmark_cmd = ( |
292 'PYTHONPATH=%s:$PYTHONPATH' % page_set_dir, | 294 'PYTHONPATH=%s:%s:$PYTHONPATH' % (page_set_dir, self._catapult_dir), |
293 'DISPLAY=%s' % X11_DISPLAY, | 295 'DISPLAY=%s' % X11_DISPLAY, |
294 'timeout', '300', | 296 'timeout', '300', |
295 os.path.join(self._telemetry_binaries_dir, 'run_benchmark'), | 297 os.path.join(self._telemetry_binaries_dir, 'run_benchmark'), |
296 '--extra-browser-args="%s"' % self._browser_args, | 298 '--extra-browser-args="%s"' % self._browser_args, |
297 '--browser=exact', | 299 '--browser=exact', |
298 '--browser-executable=%s' % self._browser_executable, | 300 '--browser-executable=%s' % self._browser_executable, |
299 SKP_BENCHMARK, | 301 SKP_BENCHMARK, |
300 '--page-set-name=%s' % page_set_basename, | 302 '--page-set-name=%s' % page_set_basename, |
301 '--page-set-base-dir=%s' % page_set_dir, | 303 '--page-set-base-dir=%s' % page_set_dir, |
302 '--skp-outdir=%s' % TMP_SKP_DIR, | 304 '--skp-outdir=%s' % TMP_SKP_DIR, |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 '--skia_tools is specified then the debugger is not run.', | 594 '--skia_tools is specified then the debugger is not run.', |
593 default=False) | 595 default=False) |
594 option_parser.add_option( | 596 option_parser.add_option( |
595 '', '--skp_prefix', | 597 '', '--skp_prefix', |
596 help='Prefix to add to the names of generated SKPs.', | 598 help='Prefix to add to the names of generated SKPs.', |
597 default=None) | 599 default=None) |
598 options, unused_args = option_parser.parse_args() | 600 options, unused_args = option_parser.parse_args() |
599 | 601 |
600 playback = SkPicturePlayback(options) | 602 playback = SkPicturePlayback(options) |
601 sys.exit(playback.Run()) | 603 sys.exit(playback.Run()) |
OLD | NEW |