| OLD | NEW |
| (Empty) |
| 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 | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 from core import perf_benchmark | |
| 6 | |
| 7 import ct_benchmarks_util | |
| 8 import page_sets | |
| 9 from page_sets import repaint_helpers | |
| 10 from telemetry import benchmark | |
| 11 from telemetry.core import discover | |
| 12 from telemetry import story | |
| 13 | |
| 14 from measurements import multipage_skpicture_printer | |
| 15 | |
| 16 | |
| 17 def _MatchPageSetName(story_set_name, story_set_base_dir): | |
| 18 story_sets = discover.DiscoverClasses(story_set_base_dir, story_set_base_dir, | |
| 19 story.StorySet).values() | |
| 20 for s in story_sets: | |
| 21 if story_set_name == s.Name(): | |
| 22 return s | |
| 23 return None | |
| 24 | |
| 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): | |
| 30 | |
| 31 @classmethod | |
| 32 def AddBenchmarkCommandLineArgs(cls, parser): | |
| 33 parser.add_option('--page-set-name', action='store', type='string') | |
| 34 parser.add_option('--page-set-base-dir', action='store', type='string') | |
| 35 parser.add_option('-m', '--mskp-outdir', | |
| 36 help='Output directory for the mSKP files') | |
| 37 | |
| 38 @classmethod | |
| 39 def ProcessCommandLineArgs(cls, parser, args): | |
| 40 if not args.page_set_name: | |
| 41 parser.error('Please specify --page-set-name') | |
| 42 if not args.page_set_base_dir: | |
| 43 parser.error('Please specify --page-set-base-dir') | |
| 44 if not args.mskp_outdir: | |
| 45 parser.error('Please specify --mskp-outdir') | |
| 46 | |
| 47 @classmethod | |
| 48 def Name(cls): | |
| 49 return 'multipage_skpicture_printer' | |
| 50 | |
| 51 def CreatePageTest(self, options): | |
| 52 return multipage_skpicture_printer.MultipageSkpicturePrinter( | |
| 53 options.mskp_outdir) | |
| 54 | |
| 55 def CreateStorySet(self, options): | |
| 56 story_set_class = _MatchPageSetName(options.page_set_name, | |
| 57 options.page_set_base_dir) | |
| 58 return story_set_class() | |
| 59 | |
| 60 | |
| 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): | |
| 65 """Captures mSKPs for Cluster Telemetry.""" | |
| 66 | |
| 67 @classmethod | |
| 68 def Name(cls): | |
| 69 return 'multipage_skpicture_printer_ct' | |
| 70 | |
| 71 @classmethod | |
| 72 def AddBenchmarkCommandLineArgs(cls, parser): | |
| 73 ct_benchmarks_util.AddBenchmarkCommandLineArgs(parser) | |
| 74 parser.add_option('-m', '--mskp-outdir', | |
| 75 default=None, | |
| 76 help='Output directory for the mSKP files') | |
| 77 | |
| 78 @classmethod | |
| 79 def ProcessCommandLineArgs(cls, parser, args): | |
| 80 ct_benchmarks_util.ValidateCommandLineArgs(parser, args) | |
| 81 | |
| 82 def CreatePageTest(self, options): | |
| 83 return multipage_skpicture_printer.MultipageSkpicturePrinter( | |
| 84 options.mskp_outdir) | |
| 85 | |
| 86 def CreateStorySet(self, options): | |
| 87 return page_sets.CTPageSet( | |
| 88 options.urls_list, options.user_agent, options.archive_data_file, | |
| 89 run_page_interaction_callback=repaint_helpers.WaitThenRepaint) | |
| OLD | NEW |