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

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: [Telemetry] Add benchmark that doesn't launch chrome and collects platform data. 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
« tools/perf/benchmarks/power.py ('K') | « tools/perf/benchmarks/power.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..596c30e8c48fe5153b4bfc6c7ae56bd47fbcde95
--- /dev/null
+++ b/tools/perf/page_sets/idle_platform.py
@@ -0,0 +1,45 @@
+# Copyright 2017 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):
+ super(_IdleSharedState, self).__init__(test, finder_options, story_set)
+ self._current_story = None
+
+ 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.
nednguyen 2017/03/30 22:01:40 We don't need to worry about supporting this for l
rnephew (Reviews Here) 2017/04/03 16:25:35 Done.
+ self.platform.tracing_controller.ClearStateIfNeeded()
+
+ def RunStory(self, _):
+ self._current_story.Run(self)
+
+ def DidRunStory(self, _):
+ self._current_story = None
+
+
+class IdleStory(story.Story):
nednguyen 2017/03/30 22:07:56 make this private: _IdleStory
rnephew (Reviews Here) 2017/04/03 16:25:35 Done.
+ def __init__(self, name, duration=30):
nednguyen 2017/03/30 22:07:55 No need to set a default param here if this is onl
rnephew (Reviews Here) 2017/04/03 16:25:35 Done.
+ super(IdleStory, self).__init__(
+ shared_state_class=_IdleSharedState, name=name)
+ self._duration = duration
+
+ def Run(self, shared_state):
+ time.sleep(self._duration)
+
+
+class IdleStorySet(story.StorySet):
+ def __init__(self):
+ super(IdleStorySet, self).__init__(
+ archive_data_file=None)
+ self.AddStory(IdleStory('Idle Platform'))
nednguyen 2017/03/30 22:07:56 Can you create 3 stories: self.AddStory(IdleStory
rnephew (Reviews Here) 2017/04/03 16:25:35 Done.
« tools/perf/benchmarks/power.py ('K') | « tools/perf/benchmarks/power.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698