Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 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 import ct_benchmarks_util |
| 8 import page_sets | 8 import page_sets |
| 9 from telemetry import benchmark | 9 from telemetry import benchmark |
| 10 from telemetry.core import discover | 10 from telemetry.core import discover |
| 11 from telemetry import story | 11 from telemetry import story |
| 12 | 12 |
| 13 from measurements import skpicture_printer | 13 from measurements import multipage_skpicture_printer |
| 14 | 14 |
| 15 | 15 |
| 16 def _MatchPageSetName(story_set_name, story_set_base_dir): | 16 def _MatchPageSetName(story_set_name, story_set_base_dir): |
| 17 story_sets = discover.DiscoverClasses(story_set_base_dir, story_set_base_dir, | 17 story_sets = discover.DiscoverClasses(story_set_base_dir, story_set_base_dir, |
| 18 story.StorySet).values() | 18 story.StorySet).values() |
| 19 for s in story_sets: | 19 for s in story_sets: |
| 20 if story_set_name == s.Name(): | 20 if story_set_name == s.Name(): |
| 21 return s | 21 return s |
| 22 return None | 22 return None |
| 23 | 23 |
| 24 | 24 |
| 25 @benchmark.Disabled('all') | 25 @benchmark.Disabled('all') |
|
nednguyen
2016/08/29 14:00:41
nits: can you add documentation explaining why we
rmistry
2016/08/29 14:24:55
Done. Also made change to skpicture_printer.py
| |
| 26 class SkpicturePrinter(perf_benchmark.PerfBenchmark): | 26 class MultipageSkpicturePrinter(perf_benchmark.PerfBenchmark): |
| 27 | 27 |
| 28 @classmethod | 28 @classmethod |
| 29 def AddBenchmarkCommandLineArgs(cls, parser): | 29 def AddBenchmarkCommandLineArgs(cls, parser): |
| 30 parser.add_option('--page-set-name', action='store', type='string') | 30 parser.add_option('--page-set-name', action='store', type='string') |
| 31 parser.add_option('--page-set-base-dir', action='store', type='string') | 31 parser.add_option('--page-set-base-dir', action='store', type='string') |
| 32 parser.add_option('-s', '--skp-outdir', | 32 parser.add_option('-m', '--mskp-outdir', |
| 33 help='Output directory for the SKP files') | 33 help='Output directory for the mSKP files') |
| 34 | 34 |
| 35 @classmethod | 35 @classmethod |
| 36 def ProcessCommandLineArgs(cls, parser, args): | 36 def ProcessCommandLineArgs(cls, parser, args): |
| 37 if not args.page_set_name: | 37 if not args.page_set_name: |
| 38 parser.error('Please specify --page-set-name') | 38 parser.error('Please specify --page-set-name') |
| 39 if not args.page_set_base_dir: | 39 if not args.page_set_base_dir: |
| 40 parser.error('Please specify --page-set-base-dir') | 40 parser.error('Please specify --page-set-base-dir') |
| 41 if not args.skp_outdir: | 41 if not args.mskp_outdir: |
| 42 parser.error('Please specify --skp-outdir') | 42 parser.error('Please specify --mskp-outdir') |
| 43 | 43 |
| 44 @classmethod | 44 @classmethod |
| 45 def Name(cls): | 45 def Name(cls): |
| 46 return 'skpicture_printer' | 46 return 'multipage_skpicture_printer' |
| 47 | 47 |
| 48 def CreatePageTest(self, options): | 48 def CreatePageTest(self, options): |
| 49 return skpicture_printer.SkpicturePrinter(options.skp_outdir) | 49 return multipage_skpicture_printer.MultipageSkpicturePrinter( |
| 50 options.mskp_outdir) | |
| 50 | 51 |
| 51 def CreateStorySet(self, options): | 52 def CreateStorySet(self, options): |
| 52 story_set_class = _MatchPageSetName(options.page_set_name, | 53 story_set_class = _MatchPageSetName(options.page_set_name, |
| 53 options.page_set_base_dir) | 54 options.page_set_base_dir) |
| 54 return story_set_class() | 55 return story_set_class() |
| 55 | 56 |
| 56 | 57 |
| 57 # Disabled because we do not plan on running CT benchmarks on the perf | 58 # Disabled because we do not plan on running CT benchmarks on the perf |
| 58 # waterfall any time soon. | 59 # waterfall any time soon. |
| 59 @benchmark.Disabled('all') | 60 @benchmark.Disabled('all') |
| 60 class SkpicturePrinterCT(perf_benchmark.PerfBenchmark): | 61 class MultipageSkpicturePrinterCT(perf_benchmark.PerfBenchmark): |
| 61 """Captures SKPs for Cluster Telemetry.""" | 62 """Captures mSKPs for Cluster Telemetry.""" |
| 62 | 63 |
| 63 @classmethod | 64 @classmethod |
| 64 def Name(cls): | 65 def Name(cls): |
| 65 return 'skpicture_printer_ct' | 66 return 'multipage_skpicture_printer_ct' |
| 66 | 67 |
| 67 @classmethod | 68 @classmethod |
| 68 def AddBenchmarkCommandLineArgs(cls, parser): | 69 def AddBenchmarkCommandLineArgs(cls, parser): |
| 69 ct_benchmarks_util.AddBenchmarkCommandLineArgs(parser) | 70 ct_benchmarks_util.AddBenchmarkCommandLineArgs(parser) |
| 70 parser.add_option('-s', '--skp-outdir', | 71 parser.add_option('-m', '--mskp-outdir', |
| 71 default=None, | 72 default=None, |
| 72 help='Output directory for the SKP files') | 73 help='Output directory for the mSKP files') |
| 73 | 74 |
| 74 @classmethod | 75 @classmethod |
| 75 def ProcessCommandLineArgs(cls, parser, args): | 76 def ProcessCommandLineArgs(cls, parser, args): |
| 76 ct_benchmarks_util.ValidateCommandLineArgs(parser, args) | 77 ct_benchmarks_util.ValidateCommandLineArgs(parser, args) |
| 77 | 78 |
| 78 def CreatePageTest(self, options): | 79 def CreatePageTest(self, options): |
| 79 return skpicture_printer.SkpicturePrinter(options.skp_outdir) | 80 return multipage_skpicture_printer.MultipageSkpicturePrinter( |
| 81 options.mskp_outdir) | |
| 80 | 82 |
| 81 def CreateStorySet(self, options): | 83 def CreateStorySet(self, options): |
| 82 return page_sets.CTPageSet( | 84 return page_sets.CTPageSet( |
| 83 options.urls_list, options.user_agent, options.archive_data_file) | 85 options.urls_list, options.user_agent, options.archive_data_file) |
| OLD | NEW |