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

Side by Side Diff: tools/perf/measurements/power.py

Issue 1092393002: Telemetry: Quiescent power benchmarks for Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@safari-backend
Patch Set: Fix unit test 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 unified diff | Download patch
« no previous file with comments | « tools/perf/measurements/page_cycler_unittest.py ('k') | tools/perf/metrics/cpu.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from telemetry.page import page_test 5 import time
6 6
7 from metrics import power 7 from metrics import power
8 from telemetry.core import util
9 from telemetry.page import page_test
8 10
9 11
10 class Power(page_test.PageTest): 12 class Power(page_test.PageTest):
13 """Measures power draw and idle wakeups during the page's interactions."""
14
11 def __init__(self): 15 def __init__(self):
12 super(Power, self).__init__() 16 super(Power, self).__init__()
13 self._power_metric = None 17 self._power_metric = None
14 18
15 def WillStartBrowser(self, platform): 19 def WillStartBrowser(self, platform):
16 self._power_metric = power.PowerMetric(platform) 20 self._power_metric = power.PowerMetric(platform)
17 21
18 def DidNavigateToPage(self, page, tab): 22 def DidNavigateToPage(self, page, tab):
19 self._power_metric.Start(page, tab) 23 self._power_metric.Start(page, tab)
20 24
21 def ValidateAndMeasurePage(self, page, tab, results): 25 def ValidateAndMeasurePage(self, page, tab, results):
22 self._power_metric.Stop(page, tab) 26 self._power_metric.Stop(page, tab)
23 self._power_metric.AddResults(tab, results) 27 self._power_metric.AddResults(tab, results)
28
29
30 class QuiescentPower(page_test.PageTest):
31 """Measures power draw and idle wakeups after the page finished loading."""
32
33 # Amount of time to measure, in seconds.
34 SAMPLE_TIME = 30
35
36 def ValidateAndMeasurePage(self, page, tab, results):
37 if not tab.browser.platform.CanMonitorPower():
38 return
39
40 util.WaitFor(tab.HasReachedQuiescence, 60)
41
42 metric = power.PowerMetric(tab.browser.platform)
43 metric.Start(page, tab)
44
45 time.sleep(QuiescentPower.SAMPLE_TIME)
46
47 metric.Stop(page, tab)
48 metric.AddResults(tab, results)
OLDNEW
« no previous file with comments | « tools/perf/measurements/page_cycler_unittest.py ('k') | tools/perf/metrics/cpu.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698