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 import os | 5 import os |
6 | 6 |
7 from page_sets.system_health import platforms | 7 from page_sets.system_health import platforms |
8 from page_sets.system_health import system_health_story | 8 from page_sets.system_health import system_health_story |
9 | 9 |
10 from telemetry import story | 10 from telemetry import story |
(...skipping 13 matching lines...) Expand all Loading... |
24 assert platform in platforms.ALL_PLATFORMS | 24 assert platform in platforms.ALL_PLATFORMS |
25 | 25 |
26 for story_class in _IterAllSystemHealthStoryClasses(): | 26 for story_class in _IterAllSystemHealthStoryClasses(): |
27 if (story_class.ABSTRACT_STORY or | 27 if (story_class.ABSTRACT_STORY or |
28 platform not in story_class.SUPPORTED_PLATFORMS or | 28 platform not in story_class.SUPPORTED_PLATFORMS or |
29 case and not story_class.NAME.startswith(case + ':')): | 29 case and not story_class.NAME.startswith(case + ':')): |
30 continue | 30 continue |
31 self.AddStory(story_class(self, take_memory_measurement)) | 31 self.AddStory(story_class(self, take_memory_measurement)) |
32 | 32 |
33 | 33 |
| 34 class DesktopSystemHealthStorySet(SystemHealthStorySet): |
| 35 """Desktop user stories for the System Health Plan. |
| 36 |
| 37 Note: This story set is only intended to be used for recording stories via |
| 38 tools/perf/record_wpr. If you would like to use it in a benchmark, please use |
| 39 the generic SystemHealthStorySet class instead (you'll need to override the |
| 40 CreateStorySet method of your benchmark). |
| 41 """ |
| 42 def __init__(self): |
| 43 super(DesktopSystemHealthStorySet, self).__init__( |
| 44 'desktop', take_memory_measurement=False) |
| 45 |
| 46 |
| 47 class MobileSystemHealthStorySet(SystemHealthStorySet): |
| 48 """Mobile user stories for the System Health Plan. |
| 49 |
| 50 Note: This story set is only intended to be used for recording stories via |
| 51 tools/perf/record_wpr. If you would like to use it in a benchmark, please use |
| 52 the generic SystemHealthStorySet class instead (you'll need to override the |
| 53 CreateStorySet method of your benchmark). |
| 54 """ |
| 55 def __init__(self): |
| 56 super(MobileSystemHealthStorySet, self).__init__( |
| 57 'mobile', take_memory_measurement=False) |
| 58 |
| 59 |
34 def _IterAllSystemHealthStoryClasses(): | 60 def _IterAllSystemHealthStoryClasses(): |
35 start_dir = os.path.dirname(os.path.abspath(__file__)) | 61 start_dir = os.path.dirname(os.path.abspath(__file__)) |
36 # Sort the classes by their names so that their order is stable and | 62 # Sort the classes by their names so that their order is stable and |
37 # deterministic. | 63 # deterministic. |
38 for unused_cls_name, cls in sorted(discover.DiscoverClasses( | 64 for unused_cls_name, cls in sorted(discover.DiscoverClasses( |
39 start_dir=start_dir, | 65 start_dir=start_dir, |
40 top_level_dir=os.path.dirname(start_dir), | 66 top_level_dir=os.path.dirname(start_dir), |
41 base_class=system_health_story.SystemHealthStory).iteritems()): | 67 base_class=system_health_story.SystemHealthStory).iteritems()): |
42 yield cls | 68 yield cls |
OLD | NEW |