| OLD | NEW |
| (Empty) |
| 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 | |
| 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 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 SKP benchmark on the perf | |
| 27 # waterfall any time soon. | |
| 28 @benchmark.Disabled('all') | |
| 29 @benchmark.Owner(emails=['rmistry@chromium.org']) | |
| 30 class SkpicturePrinter(perf_benchmark.PerfBenchmark): | |
| 31 | |
| 32 @classmethod | |
| 33 def AddBenchmarkCommandLineArgs(cls, parser): | |
| 34 parser.add_option('--page-set-name', action='store', type='string') | |
| 35 parser.add_option('--page-set-base-dir', action='store', type='string') | |
| 36 parser.add_option('-s', '--skp-outdir', | |
| 37 help='Output directory for the SKP files') | |
| 38 | |
| 39 @classmethod | |
| 40 def ProcessCommandLineArgs(cls, parser, args): | |
| 41 if not args.page_set_name: | |
| 42 parser.error('Please specify --page-set-name') | |
| 43 if not args.page_set_base_dir: | |
| 44 parser.error('Please specify --page-set-base-dir') | |
| 45 if not args.skp_outdir: | |
| 46 parser.error('Please specify --skp-outdir') | |
| 47 | |
| 48 @classmethod | |
| 49 def Name(cls): | |
| 50 return 'skpicture_printer' | |
| 51 | |
| 52 def CreatePageTest(self, options): | |
| 53 return skpicture_printer.SkpicturePrinter(options.skp_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 SkpicturePrinterCT(perf_benchmark.PerfBenchmark): | |
| 65 """Captures SKPs for Cluster Telemetry.""" | |
| 66 | |
| 67 @classmethod | |
| 68 def Name(cls): | |
| 69 return 'skpicture_printer_ct' | |
| 70 | |
| 71 @classmethod | |
| 72 def AddBenchmarkCommandLineArgs(cls, parser): | |
| 73 ct_benchmarks_util.AddBenchmarkCommandLineArgs(parser) | |
| 74 parser.add_option('-s', '--skp-outdir', | |
| 75 default=None, | |
| 76 help='Output directory for the SKP 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 skpicture_printer.SkpicturePrinter(options.skp_outdir) | |
| 84 | |
| 85 def CreateStorySet(self, options): | |
| 86 return page_sets.CTPageSet( | |
| 87 options.urls_list, options.user_agent, options.archive_data_file, | |
| 88 run_page_interaction_callback=repaint_helpers.WaitThenRepaint) | |
| OLD | NEW |