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

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: fix archive_data_path from None to empty string Created 3 years, 8 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/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..b6fffd48a0cb0e930fca9f3439e9bf48202aa75c
--- /dev/null
+++ b/tools/perf/page_sets/idle_platform.py
@@ -0,0 +1,41 @@
+# 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
+ assert self.platform.tracing_controller.is_tracing_running
+
+ def RunStory(self, _):
+ self._current_story.Run(self)
+
+ def DidRunStory(self, _):
+ self._current_story = None
+
+
+class _IdleStory(story.Story):
+ def __init__(self, name, duration):
+ 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__()
+ self.AddStory(_IdleStory('IdleStory_10s', 10))
+ self.AddStory(_IdleStory('IdleStory_60s', 60))
+ self.AddStory(_IdleStory('IdleStory_120s', 120))
« no previous file with comments | « tools/perf/benchmarks/power.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698