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

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

Issue 2276943002: [system-health] Add support for recording stories directly through story set (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Explicit take_memory_measurement=False Created 4 years, 3 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
« no previous file with comments | « tools/perf/page_sets/system_health/system_health_stories.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 from page_sets.system_health import platforms 5 from page_sets.system_health import platforms
6 6
7 from telemetry.page import page 7 from telemetry.page import page
8 8
9 9
10 # Extra wait time after the page has loaded required by the loading metric. We 10 # Extra wait time after the page has loaded required by the loading metric. We
(...skipping 29 matching lines...) Expand all
40 40
41 def __init__(self, story_set, take_memory_measurement): 41 def __init__(self, story_set, take_memory_measurement):
42 case, group, _ = self.NAME.split(':') 42 case, group, _ = self.NAME.split(':')
43 super(SystemHealthStory, self).__init__( 43 super(SystemHealthStory, self).__init__(
44 page_set=story_set, name=self.NAME, url=self.URL, 44 page_set=story_set, name=self.NAME, url=self.URL,
45 credentials_path='../data/credentials.json', 45 credentials_path='../data/credentials.json',
46 grouping_keys={'case': case, 'group': group}) 46 grouping_keys={'case': case, 'group': group})
47 self._take_memory_measurement = take_memory_measurement 47 self._take_memory_measurement = take_memory_measurement
48 48
49 def _Measure(self, action_runner): 49 def _Measure(self, action_runner):
50 if self._ShouldMeasureMemory(action_runner): 50 if self._take_memory_measurement:
51 action_runner.MeasureMemory(deterministic_mode=True) 51 action_runner.MeasureMemory(deterministic_mode=True)
52 else: 52 else:
53 action_runner.Wait(_WAIT_TIME_AFTER_LOAD) 53 action_runner.Wait(_WAIT_TIME_AFTER_LOAD)
54 54
55 def _ShouldMeasureMemory(self, action_runner):
56 if not self._take_memory_measurement:
57 return False
58 # The check below is also performed in action_runner.MeasureMemory().
59 # However, we need to duplicate it here so that the story would wait for
60 # |_WAIT_TIME_AFTER_LOAD| seconds after load when recorded via the
61 # system_health.memory_* benchmarks.
62 # TODO(petrcermak): Make it possible (and mandatory) to record the story
63 # directly through the story set and remove this check.
64 tracing_controller = action_runner.tab.browser.platform.tracing_controller
65 if not tracing_controller.is_tracing_running:
66 return False # Tracing is not running, e.g. when recording a WPR archive.
67 return True
68
69 def _Login(self, action_runner): 55 def _Login(self, action_runner):
70 pass 56 pass
71 57
72 def _DidLoadDocument(self, action_runner): 58 def _DidLoadDocument(self, action_runner):
73 pass 59 pass
74 60
75 def RunNavigateSteps(self, action_runner): 61 def RunNavigateSteps(self, action_runner):
76 self._Login(action_runner) 62 self._Login(action_runner)
77 super(SystemHealthStory, self).RunNavigateSteps(action_runner) 63 super(SystemHealthStory, self).RunNavigateSteps(action_runner)
78 64
79 def RunPageInteractions(self, action_runner): 65 def RunPageInteractions(self, action_runner):
80 action_runner.tab.WaitForDocumentReadyStateToBeComplete() 66 action_runner.tab.WaitForDocumentReadyStateToBeComplete()
81 self._DidLoadDocument(action_runner) 67 self._DidLoadDocument(action_runner)
82 self._Measure(action_runner) 68 self._Measure(action_runner)
OLDNEW
« no previous file with comments | « tools/perf/page_sets/system_health/system_health_stories.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698