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

Unified Diff: tools/perf/measurements/energy.py

Issue 1092393002: Telemetry: Quiescent power benchmarks for Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@safari-backend
Patch Set: Created 5 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
Index: tools/perf/measurements/energy.py
diff --git a/tools/perf/measurements/energy.py b/tools/perf/measurements/energy.py
new file mode 100644
index 0000000000000000000000000000000000000000..5867294d8292a757aa46d15636c11435d53bd5a3
--- /dev/null
+++ b/tools/perf/measurements/energy.py
@@ -0,0 +1,27 @@
+# Copyright 2015 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 metrics import cpu
+from metrics import power
+from telemetry.page import page_test
+
+
+class Energy(page_test.PageTest):
+ """Measures power usage, idle wakeups, and CPU utilization."""
+
+ # Amount of time to measure, in seconds.
+ SAMPLE_TIME = 10
+
+ def ValidateAndMeasurePage(self, page, tab, results):
+ metrics = [ power.PowerMetric(tab.browser.platform), cpu.CpuMetric(tab.browser) ]
ccameron 2015/04/20 21:36:33 It may be a good idea to wait for a few seconds he
Andre 2015/04/20 21:52:40 metric.PowerMetric supports measuring quiescent po
Andre 2015/04/22 00:46:54 I've added util.WaitFor(tab.hasReachedQuiescence)
+ for metric in metrics:
+ metric.Start(page, tab)
+
+ time.sleep(Energy.SAMPLE_TIME)
+
+ for metric in metrics:
+ metric.Stop(page, tab)
+ metric.AddResults(tab, results)

Powered by Google App Engine
This is Rietveld 408576698