Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(595)

Side by Side Diff: tools/perf/page_sets/system_health/system_health_stories.py

Issue 2386083003: Add background stories to MobileSystemHealth (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 from telemetry.core import discover 11 from telemetry.core import discover
12 12
13 13
14 class SystemHealthStorySet(story.StorySet): 14 class SystemHealthStorySet(story.StorySet):
15 """User stories for the System Health Plan. 15 """User stories for the System Health Plan.
16 16
17 See https://goo.gl/Jek2NL. 17 See https://goo.gl/Jek2NL.
18 """ 18 """
19 def __init__(self, platform, case=None, take_memory_measurement=False): 19 def __init__(self, platform, case=None, take_memory_measurement=False,
20 measure_in_background=False):
20 super(SystemHealthStorySet, self).__init__( 21 super(SystemHealthStorySet, self).__init__(
21 archive_data_file=('../data/system_health_%s.json' % platform), 22 archive_data_file=('../data/system_health_%s.json' % platform),
22 cloud_storage_bucket=story.PARTNER_BUCKET) 23 cloud_storage_bucket=story.PARTNER_BUCKET)
23 24
24 assert platform in platforms.ALL_PLATFORMS 25 assert platform in platforms.ALL_PLATFORMS
25 26
26 for story_class in _IterAllSystemHealthStoryClasses(): 27 for story_class in _IterAllSystemHealthStoryClasses():
27 if (story_class.ABSTRACT_STORY or 28 if (story_class.ABSTRACT_STORY or
28 platform not in story_class.SUPPORTED_PLATFORMS or 29 platform not in story_class.SUPPORTED_PLATFORMS or
29 case and not story_class.NAME.startswith(case + ':')): 30 case and not story_class.NAME.startswith(case + ':')):
30 continue 31 continue
31 self.AddStory(story_class(self, take_memory_measurement)) 32 self.AddStory(
33 story_class(self, take_memory_measurement, measure_in_background))
32 34
33 35
34 class DesktopSystemHealthStorySet(SystemHealthStorySet): 36 class DesktopSystemHealthStorySet(SystemHealthStorySet):
35 """Desktop user stories for the System Health Plan. 37 """Desktop user stories for the System Health Plan.
36 38
37 Note: This story set is only intended to be used for recording stories via 39 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 40 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 41 the generic SystemHealthStorySet class instead (you'll need to override the
40 CreateStorySet method of your benchmark). 42 CreateStorySet method of your benchmark).
41 """ 43 """
(...skipping 17 matching lines...) Expand all
59 61
60 def _IterAllSystemHealthStoryClasses(): 62 def _IterAllSystemHealthStoryClasses():
61 start_dir = os.path.dirname(os.path.abspath(__file__)) 63 start_dir = os.path.dirname(os.path.abspath(__file__))
62 # Sort the classes by their names so that their order is stable and 64 # Sort the classes by their names so that their order is stable and
63 # deterministic. 65 # deterministic.
64 for unused_cls_name, cls in sorted(discover.DiscoverClasses( 66 for unused_cls_name, cls in sorted(discover.DiscoverClasses(
65 start_dir=start_dir, 67 start_dir=start_dir,
66 top_level_dir=os.path.dirname(start_dir), 68 top_level_dir=os.path.dirname(start_dir),
67 base_class=system_health_story.SystemHealthStory).iteritems()): 69 base_class=system_health_story.SystemHealthStory).iteritems()):
68 yield cls 70 yield cls
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698