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__('desktop') | |
nednguyen
2016/08/24 17:23:39
nits: explicitly specify take_memory_measurement=F
petrcermak
2016/08/24 17:49:46
Done.
| |
44 | |
45 | |
46 class MobileSystemHealthStorySet(SystemHealthStorySet): | |
47 """Mobile user stories for the System Health Plan. | |
48 | |
49 Note: This story set is only intended to be used for recording stories via | |
50 tools/perf/record_wpr. If you would like to use it in a benchmark, please use | |
51 the generic SystemHealthStorySet class instead (you'll need to override the | |
52 CreateStorySet method of your benchmark). | |
53 """ | |
54 def __init__(self): | |
55 super(MobileSystemHealthStorySet, self).__init__('mobile') | |
56 | |
57 | |
34 def _IterAllSystemHealthStoryClasses(): | 58 def _IterAllSystemHealthStoryClasses(): |
35 start_dir = os.path.dirname(os.path.abspath(__file__)) | 59 start_dir = os.path.dirname(os.path.abspath(__file__)) |
36 # Sort the classes by their names so that their order is stable and | 60 # Sort the classes by their names so that their order is stable and |
37 # deterministic. | 61 # deterministic. |
38 for unused_cls_name, cls in sorted(discover.DiscoverClasses( | 62 for unused_cls_name, cls in sorted(discover.DiscoverClasses( |
39 start_dir=start_dir, | 63 start_dir=start_dir, |
40 top_level_dir=os.path.dirname(start_dir), | 64 top_level_dir=os.path.dirname(start_dir), |
41 base_class=system_health_story.SystemHealthStory).iteritems()): | 65 base_class=system_health_story.SystemHealthStory).iteritems()): |
42 yield cls | 66 yield cls |
OLD | NEW |