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