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

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

Issue 2144073004: [system-health] Unify SH stories interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restrict story selector Created 4 years, 5 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
6
5 from page_sets.system_health import platforms 7 from page_sets.system_health import platforms
6 from page_sets.system_health import loading_stories 8 from page_sets.system_health import system_health_story
7 9
8 from telemetry import story 10 from telemetry import story
11 from telemetry.core import discover
9 12
10 13
11 class _SystemHealthStorySet(story.StorySet): 14 class SystemHealthStorySet(story.StorySet):
12 """User stories for the System Health Plan. 15 """User stories for the System Health Plan.
13 16
14 See https://goo.gl/Jek2NL. 17 See https://goo.gl/Jek2NL.
15 """ 18 """
16 PLATFORM = NotImplemented 19 def __init__(self, platform, case=None, take_memory_measurement=False):
20 super(SystemHealthStorySet, self).__init__(
21 archive_data_file=('../data/memory_system_health_%s.json' % platform),
22 cloud_storage_bucket=story.PARTNER_BUCKET)
17 23
18 def __init__(self, take_memory_measurement=True): 24 assert platform in platforms.ALL_PLATFORMS
19 super(_SystemHealthStorySet, self).__init__( 25
20 archive_data_file=('../data/memory_system_health_%s.json' % 26 for story_class in _IterAllSystemHealthStoryClasses():
21 self.PLATFORM), 27 if (story_class.ABSTRACT_STORY or
22 cloud_storage_bucket=story.PARTNER_BUCKET) 28 platform not in story_class.SUPPORTED_PLATFORMS or
23 for story_class in loading_stories.IterAllStoryClasses(): 29 case and not story_class.NAME.startswith(case + ':')):
24 if self.PLATFORM not in story_class.SUPPORTED_PLATFORMS:
25 continue 30 continue
26 self.AddStory(story_class(self, take_memory_measurement)) 31 self.AddStory(story_class(self, take_memory_measurement))
27 32
28 33
29 class DesktopSystemHealthStorySet(_SystemHealthStorySet): 34 def _IterAllSystemHealthStoryClasses():
30 """Desktop user stories for Chrome System Health Plan.""" 35 start_dir = os.path.dirname(os.path.abspath(__file__))
31 PLATFORM = platforms.DESKTOP 36 # Sort the classes by their names so that their order is stable and
32 37 # deterministic.
33 38 for unused_cls_name, cls in sorted(discover.DiscoverClasses(
34 class MobileSystemHealthStorySet(_SystemHealthStorySet): 39 start_dir=start_dir,
35 """Mobile user stories for Chrome System Health Plan.""" 40 top_level_dir=os.path.dirname(start_dir),
36 PLATFORM = platforms.MOBILE 41 base_class=system_health_story.SystemHealthStory).iteritems()):
42 yield cls
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698