| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 core import perf_benchmark | 5 from core import perf_benchmark |
| 6 | 6 |
| 7 import ct_benchmarks_util | 7 from contrib.cluster_telemetry import ct_benchmarks_util |
| 8 import page_sets | 8 from contrib.cluster_telemetry import page_set |
| 9 from page_sets import repaint_helpers | 9 from contrib.cluster_telemetry import repaint_helpers |
| 10 |
| 10 from telemetry import benchmark | 11 from telemetry import benchmark |
| 11 from telemetry.core import discover | 12 from telemetry.core import discover |
| 12 from telemetry import story | 13 from telemetry import story |
| 13 | 14 |
| 14 from measurements import skpicture_printer | 15 from measurements import skpicture_printer |
| 15 | 16 |
| 16 | 17 |
| 17 def _MatchPageSetName(story_set_name, story_set_base_dir): | 18 def _MatchPageSetName(story_set_name, story_set_base_dir): |
| 18 story_sets = discover.DiscoverClasses(story_set_base_dir, story_set_base_dir, | 19 story_sets = discover.DiscoverClasses(story_set_base_dir, story_set_base_dir, |
| 19 story.StorySet).values() | 20 story.StorySet).values() |
| 20 for s in story_sets: | 21 for s in story_sets: |
| 21 if story_set_name == s.Name(): | 22 if story_set_name == s.Name(): |
| 22 return s | 23 return s |
| 23 return None | 24 return None |
| 24 | 25 |
| 25 | 26 |
| 26 # Disabled because we do not plan on running this SKP benchmark on the perf | |
| 27 # waterfall any time soon. | |
| 28 @benchmark.Disabled('all') | |
| 29 @benchmark.Owner(emails=['rmistry@chromium.org']) | 27 @benchmark.Owner(emails=['rmistry@chromium.org']) |
| 30 class SkpicturePrinter(perf_benchmark.PerfBenchmark): | 28 class SkpicturePrinter(perf_benchmark.PerfBenchmark): |
| 31 | 29 |
| 32 @classmethod | 30 @classmethod |
| 33 def AddBenchmarkCommandLineArgs(cls, parser): | 31 def AddBenchmarkCommandLineArgs(cls, parser): |
| 34 parser.add_option('--page-set-name', action='store', type='string') | 32 parser.add_option('--page-set-name', action='store', type='string') |
| 35 parser.add_option('--page-set-base-dir', action='store', type='string') | 33 parser.add_option('--page-set-base-dir', action='store', type='string') |
| 36 parser.add_option('-s', '--skp-outdir', | 34 parser.add_option('-s', '--skp-outdir', |
| 37 help='Output directory for the SKP files') | 35 help='Output directory for the SKP files') |
| 38 | 36 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 51 | 49 |
| 52 def CreatePageTest(self, options): | 50 def CreatePageTest(self, options): |
| 53 return skpicture_printer.SkpicturePrinter(options.skp_outdir) | 51 return skpicture_printer.SkpicturePrinter(options.skp_outdir) |
| 54 | 52 |
| 55 def CreateStorySet(self, options): | 53 def CreateStorySet(self, options): |
| 56 story_set_class = _MatchPageSetName(options.page_set_name, | 54 story_set_class = _MatchPageSetName(options.page_set_name, |
| 57 options.page_set_base_dir) | 55 options.page_set_base_dir) |
| 58 return story_set_class() | 56 return story_set_class() |
| 59 | 57 |
| 60 | 58 |
| 61 # Disabled because we do not plan on running CT benchmarks on the perf | |
| 62 # waterfall any time soon. | |
| 63 @benchmark.Disabled('all') | |
| 64 class SkpicturePrinterCT(perf_benchmark.PerfBenchmark): | 59 class SkpicturePrinterCT(perf_benchmark.PerfBenchmark): |
| 65 """Captures SKPs for Cluster Telemetry.""" | 60 """Captures SKPs for Cluster Telemetry.""" |
| 66 | 61 |
| 67 @classmethod | 62 @classmethod |
| 68 def Name(cls): | 63 def Name(cls): |
| 69 return 'skpicture_printer_ct' | 64 return 'skpicture_printer_ct' |
| 70 | 65 |
| 71 @classmethod | 66 @classmethod |
| 72 def AddBenchmarkCommandLineArgs(cls, parser): | 67 def AddBenchmarkCommandLineArgs(cls, parser): |
| 73 ct_benchmarks_util.AddBenchmarkCommandLineArgs(parser) | 68 ct_benchmarks_util.AddBenchmarkCommandLineArgs(parser) |
| 74 parser.add_option('-s', '--skp-outdir', | 69 parser.add_option('-s', '--skp-outdir', |
| 75 default=None, | 70 default=None, |
| 76 help='Output directory for the SKP files') | 71 help='Output directory for the SKP files') |
| 77 | 72 |
| 78 @classmethod | 73 @classmethod |
| 79 def ProcessCommandLineArgs(cls, parser, args): | 74 def ProcessCommandLineArgs(cls, parser, args): |
| 80 ct_benchmarks_util.ValidateCommandLineArgs(parser, args) | 75 ct_benchmarks_util.ValidateCommandLineArgs(parser, args) |
| 81 | 76 |
| 82 def CreatePageTest(self, options): | 77 def CreatePageTest(self, options): |
| 83 return skpicture_printer.SkpicturePrinter(options.skp_outdir) | 78 return skpicture_printer.SkpicturePrinter(options.skp_outdir) |
| 84 | 79 |
| 85 def CreateStorySet(self, options): | 80 def CreateStorySet(self, options): |
| 86 return page_sets.CTPageSet( | 81 return page_set.CTPageSet( |
| 87 options.urls_list, options.user_agent, options.archive_data_file, | 82 options.urls_list, options.user_agent, options.archive_data_file, |
| 88 run_page_interaction_callback=repaint_helpers.WaitThenRepaint) | 83 run_page_interaction_callback=repaint_helpers.WaitThenRepaint) |
| OLD | NEW |