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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/perf/benchmarks/idle_platform.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/page_sets/idle_platform.py
diff --git a/tools/perf/page_sets/idle_platform.py b/tools/perf/page_sets/idle_platform.py
new file mode 100644
index 0000000000000000000000000000000000000000..6426b0c1a4a7d49a5b60936765894d24e220de17
--- /dev/null
+++ b/tools/perf/page_sets/idle_platform.py
@@ -0,0 +1,50 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+import time
+
+from telemetry.page import shared_page_state
+from telemetry import story
+
+
+class _IdleSharedState(shared_page_state.SharedPageState):
+ 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
+ super(_IdleSharedState, self).__init__(test, finder_options, story_set)
+ self._current_story = None
+ self._idle_time = idle_time
+
+ def WillRunStory(self, current_story):
+ self._current_story = current_story
+ if not self.platform.tracing_controller.is_tracing_running:
+ # For TimelineBasedMeasurement benchmarks, tracing has already started.
+ # For PageTest benchmarks, tracing has not yet started. We need to make
+ # sure no tracing state is left before starting the browser for PageTest
+ # benchmarks.
+ self.platform.tracing_controller.ClearStateIfNeeded()
+
+ def RunStory(self, _):
+ self._current_story.Run(self)
+
+ def DidRunStory(self, _):
+ self._current_story = None
+
+ @property
+ def idle_time(self):
+ return self._idle_time
+
+
+class IdlePlatformPage(story.Story):
+ def __init__(self, name):
+ super(IdlePlatformPage, self).__init__(
+ shared_state_class=_IdleSharedState, name=name)
+
+ def Run(self, shared_state):
+ time.sleep(shared_state.idle_time)
+
+
+class IdlePlatformPageSet(story.StorySet):
+ def __init__(self):
+ super(IdlePlatformPageSet, self).__init__(
+ archive_data_file=None,
+ cloud_storage_bucket=story.PARTNER_BUCKET)
+ self.AddStory(IdlePlatformPage('Idle Platform'))
« 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