| 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 import csv | 5 import csv |
| 6 import logging | 6 import logging |
| 7 import os | 7 import os |
| 8 import sys | 8 import sys |
| 9 | 9 |
| 10 from chrome_remote_control import browser_finder | 10 from chrome_remote_control import browser_finder |
| 11 from chrome_remote_control import browser_options | 11 from chrome_remote_control import browser_options |
| 12 from chrome_remote_control import multi_page_benchmark | 12 from chrome_remote_control import multi_page_benchmark |
| 13 from chrome_remote_control import page_runner | 13 from chrome_remote_control import page_runner |
| 14 from chrome_remote_control import page_set | 14 from chrome_remote_control import page_set |
| 15 | 15 |
| 16 import perf_tools.first_paint_time_benchmark | 16 import perf_tools.first_paint_time_benchmark |
| 17 import perf_tools.scrolling_benchmark | 17 import perf_tools.scrolling_benchmark |
| 18 import perf_tools.skpicture_printer | 18 import perf_tools.skpicture_printer |
| 19 import perf_tools.spaceport |
| 19 import perf_tools.texture_upload_benchmark | 20 import perf_tools.texture_upload_benchmark |
| 20 | 21 |
| 21 # TODO(tonyg/nduca): Discover benchmarks automagically. | 22 # TODO(tonyg/nduca): Discover benchmarks automagically. |
| 22 _BENCHMARKS = { | 23 _BENCHMARKS = { |
| 23 'first_paint_time_benchmark': | 24 'first_paint_time_benchmark': |
| 24 perf_tools.first_paint_time_benchmark.FirstPaintTimeBenchmark, | 25 perf_tools.first_paint_time_benchmark.FirstPaintTimeBenchmark, |
| 25 'scrolling_benchmark': | 26 'scrolling_benchmark': |
| 26 perf_tools.scrolling_benchmark.ScrollingBenchmark, | 27 perf_tools.scrolling_benchmark.ScrollingBenchmark, |
| 27 'skpicture_printer': | 28 'skpicture_printer': |
| 28 perf_tools.skpicture_printer.SkPicturePrinter, | 29 perf_tools.skpicture_printer.SkPicturePrinter, |
| 30 'spaceport': |
| 31 perf_tools.spaceport.Spaceport, |
| 29 'texture_upload_benchmark': | 32 'texture_upload_benchmark': |
| 30 perf_tools.texture_upload_benchmark.TextureUploadBenchmark | 33 perf_tools.texture_upload_benchmark.TextureUploadBenchmark |
| 31 } | 34 } |
| 32 | 35 |
| 33 | 36 |
| 34 def Main(): | 37 def Main(): |
| 35 """Turns a MultiPageBenchmark into a command-line program. | 38 """Turns a MultiPageBenchmark into a command-line program. |
| 36 | 39 |
| 37 If args is not specified, sys.argv[1:] is used. | 40 If args is not specified, sys.argv[1:] is used. |
| 38 """ | 41 """ |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 with page_runner.PageRunner(ps) as runner: | 79 with page_runner.PageRunner(ps) as runner: |
| 77 runner.Run(options, possible_browser, benchmark, results) | 80 runner.Run(options, possible_browser, benchmark, results) |
| 78 # When using an exact executable, assume it is a reference build for the | 81 # When using an exact executable, assume it is a reference build for the |
| 79 # purpose of outputting the perf results. | 82 # purpose of outputting the perf results. |
| 80 results.PrintSummary(options.browser_executable and '_ref' or '') | 83 results.PrintSummary(options.browser_executable and '_ref' or '') |
| 81 | 84 |
| 82 if len(results.page_failures): | 85 if len(results.page_failures): |
| 83 logging.warning('Failed pages: %s', '\n'.join( | 86 logging.warning('Failed pages: %s', '\n'.join( |
| 84 [failure['page'].url for failure in results.page_failures])) | 87 [failure['page'].url for failure in results.page_failures])) |
| 85 return min(255, len(results.page_failures)) | 88 return min(255, len(results.page_failures)) |
| OLD | NEW |