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

Side by Side Diff: tools/perf/page_sets/idle_platform.py

Issue 2744273003: [Telemetry] Add benchmark that doesn't launch chrome and collects platform data. (Closed)
Patch Set: page -> story Created 3 years, 9 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/benchmarks/idle_platform.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
(Empty)
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4 import time
5
6 from telemetry.page import shared_page_state
7 from telemetry import story
8
9
10 class _IdleSharedState(shared_page_state.SharedPageState):
11 def __init__(self, test, finder_options, story_set, idle_time=30):
rnephew (Reviews Here) 2017/03/13 21:29:18 I keep flopping between thinking this should be he
nednguyen 2017/03/13 21:35:51 shared_state is construct by story_runner, so its
12 super(_IdleSharedState, self).__init__(test, finder_options, story_set)
13 self._current_story = None
14 self._idle_time = idle_time
15
16 def WillRunStory(self, current_story):
17 self._current_story = current_story
18 if not self.platform.tracing_controller.is_tracing_running:
19 # For TimelineBasedMeasurement benchmarks, tracing has already started.
20 # For PageTest benchmarks, tracing has not yet started. We need to make
21 # sure no tracing state is left before starting the browser for PageTest
22 # benchmarks.
23 self.platform.tracing_controller.ClearStateIfNeeded()
24
25 def RunStory(self, _):
26 self._current_story.Run(self)
27
28 def DidRunStory(self, _):
29 self._current_story = None
30
31 @property
32 def idle_time(self):
33 return self._idle_time
34
35
36 class IdlePlatformPage(story.Story):
37 def __init__(self, name):
38 super(IdlePlatformPage, self).__init__(
39 shared_state_class=_IdleSharedState, name=name)
40
41 def Run(self, shared_state):
42 time.sleep(shared_state.idle_time)
43
44
45 class IdlePlatformPageSet(story.StorySet):
46 def __init__(self):
47 super(IdlePlatformPageSet, self).__init__(
48 archive_data_file=None,
49 cloud_storage_bucket=story.PARTNER_BUCKET)
50 self.AddStory(IdlePlatformPage('Idle Platform'))
OLDNEW
« no previous file with comments | « tools/perf/benchmarks/idle_platform.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698