Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from benchmarks import skpicture_printer | |
| 5 from core import perf_benchmark | 6 from core import perf_benchmark |
| 6 | 7 |
| 7 from measurements import rasterize_and_record_micro | 8 from measurements import rasterize_and_record_micro |
| 8 import page_sets | 9 import page_sets |
| 9 from telemetry import benchmark | 10 from telemetry import benchmark |
| 10 | 11 |
| 11 | 12 |
| 12 class _RasterizeAndRecordMicro(perf_benchmark.PerfBenchmark): | 13 class _RasterizeAndRecordMicro(perf_benchmark.PerfBenchmark): |
| 13 @classmethod | 14 @classmethod |
| 14 def AddBenchmarkCommandLineArgs(cls, parser): | 15 def AddBenchmarkCommandLineArgs(cls, parser): |
| 15 parser.add_option('--start-wait-time', type='float', | 16 parser.add_option('--start-wait-time', type='float', |
| 16 default=2, | 17 default=2, |
| 17 help='Wait time before the benchmark is started ' | 18 help='Wait time before the benchmark is started ' |
| 18 '(must be long enought to load all content)') | 19 '(must be long enought to load all content)') |
| 19 parser.add_option('--rasterize-repeat', type='int', | 20 parser.add_option('--rasterize-repeat', type='int', |
| 20 default=100, | 21 default=100, |
| 21 help='Repeat each raster this many times. Increase ' | 22 help='Repeat each raster this many times. Increase ' |
| 22 'this value to reduce variance.') | 23 'this value to reduce variance.') |
| 23 parser.add_option('--record-repeat', type='int', | 24 parser.add_option('--record-repeat', type='int', |
| 24 default=100, | 25 default=100, |
| 25 help='Repeat each record this many times. Increase ' | 26 help='Repeat each record this many times. Increase ' |
| 26 'this value to reduce variance.') | 27 'this value to reduce variance.') |
| 27 parser.add_option('--timeout', type='int', | 28 parser.add_option('--timeout', type='int', |
| 28 default=120, | 29 default=120, |
| 29 help='The length of time to wait for the micro ' | 30 help='The length of time to wait for the micro ' |
| 30 'benchmark to finish, expressed in seconds.') | 31 'benchmark to finish, expressed in seconds.') |
| 31 parser.add_option('--report-detailed-results', | 32 parser.add_option('--report-detailed-results', |
| 32 action='store_true', | 33 action='store_true', |
| 33 help='Whether to report additional detailed results.') | 34 help='Whether to report additional detailed results.') |
| 35 parser.add_option('--page-set-name', action='store', type='string', | |
| 36 default=None) | |
| 37 parser.add_option('--page-set-base-dir', action='store', type='string', | |
| 38 default=None) | |
| 34 | 39 |
| 35 @classmethod | 40 @classmethod |
| 36 def Name(cls): | 41 def Name(cls): |
| 37 return 'rasterize_and_record_micro' | 42 return 'rasterize_and_record_micro' |
| 38 | 43 |
| 39 def CreatePageTest(self, options): | 44 def CreatePageTest(self, options): |
| 40 return rasterize_and_record_micro.RasterizeAndRecordMicro( | 45 return rasterize_and_record_micro.RasterizeAndRecordMicro( |
| 41 options.start_wait_time, options.rasterize_repeat, | 46 options.start_wait_time, options.rasterize_repeat, |
| 42 options.record_repeat, options.timeout, options.report_detailed_results) | 47 options.record_repeat, options.timeout, options.report_detailed_results) |
| 43 | 48 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 """Measures rasterize and record performance on the Polymer cases. | 93 """Measures rasterize and record performance on the Polymer cases. |
| 89 | 94 |
| 90 http://www.chromium.org/developers/design-documents/rendering-benchmarks""" | 95 http://www.chromium.org/developers/design-documents/rendering-benchmarks""" |
| 91 | 96 |
| 92 @classmethod | 97 @classmethod |
| 93 def Name(cls): | 98 def Name(cls): |
| 94 return 'rasterize_and_record_micro.polymer' | 99 return 'rasterize_and_record_micro.polymer' |
| 95 | 100 |
| 96 def CreateStorySet(self, options): | 101 def CreateStorySet(self, options): |
| 97 return page_sets.PolymerPageSet(run_no_page_interactions=True) | 102 return page_sets.PolymerPageSet(run_no_page_interactions=True) |
| 103 | |
| 104 | |
| 105 @benchmark.Disabled | |
| 106 class RasterizeAndRecordMicroCustomPageSet(_RasterizeAndRecordMicro): | |
| 107 """Measures rasterize and record performance on a custom page set.""" | |
| 108 | |
| 109 @classmethod | |
| 110 def Name(cls): | |
| 111 return 'rasterize_and_record_micro.custom' | |
| 112 | |
| 113 @classmethod | |
| 114 def ProcessCommandLineArgs(cls, parser, args): | |
| 115 if not args.page_set_name: | |
| 116 parser.error('Please specify --page-set-name') | |
| 117 if not args.page_set_base_dir: | |
| 118 parser.error('Please specify --page-set-base-dir') | |
| 119 | |
| 120 def CreateStorySet(self, options): | |
| 121 page_set_class = skpicture_printer.MatchPageSetName( | |
| 122 options.page_set_name, options.page_set_base_dir) | |
| 123 return page_set_class() | |
|
nednguyen
2015/10/07 17:42:25
This restrict yourself to only be able to create p
| |
| OLD | NEW |