Commit 91660806 authored by andresantoso's avatar andresantoso Committed by Commit bot

Telemetry: Quiescent power benchmarks for Mac

Add benchmark and measurement for measuring quiescent power, and enable
it on Mac.
Moved the workaround for http://crbug.com/419786 so that we don't lose idle
wakeups numbers for the renderer process.

Review URL: https://codereview.chromium.org/1092393002

Cr-Commit-Position: refs/heads/master@{#326698}
parent 03256e5f
...@@ -18,7 +18,6 @@ class PowerAndroidAcceptance(benchmark.Benchmark): ...@@ -18,7 +18,6 @@ class PowerAndroidAcceptance(benchmark.Benchmark):
return 'power.android_acceptance' return 'power.android_acceptance'
@benchmark.Enabled('android') @benchmark.Enabled('android')
class PowerTypical10Mobile(benchmark.Benchmark): class PowerTypical10Mobile(benchmark.Benchmark):
"""Android typical 10 mobile power test.""" """Android typical 10 mobile power test."""
...@@ -29,3 +28,21 @@ class PowerTypical10Mobile(benchmark.Benchmark): ...@@ -29,3 +28,21 @@ class PowerTypical10Mobile(benchmark.Benchmark):
return 'power.typical_10_mobile' return 'power.typical_10_mobile'
@benchmark.Enabled('mac')
class PowerTop10(benchmark.Benchmark):
"""Top 10 quiescent power test."""
test = power.QuiescentPower
page_set = page_sets.Top10PageSet
@classmethod
def Name(cls):
return 'power.top_10'
@benchmark.Enabled('mac')
class PowerTop25(benchmark.Benchmark):
"""Top 25 quiescent power test."""
test = power.QuiescentPower
page_set = page_sets.Top25PageSet
@classmethod
def Name(cls):
return 'power.top_25'
...@@ -227,7 +227,7 @@ class PageCyclerUnitTest(unittest.TestCase): ...@@ -227,7 +227,7 @@ class PageCyclerUnitTest(unittest.TestCase):
# On Mac, there is an additional measurement: the number of keychain # On Mac, there is an additional measurement: the number of keychain
# accesses. # accesses.
value_count = 4 value_count = 3
if sys.platform == 'darwin': if sys.platform == 'darwin':
value_count += 1 value_count += 1
self.assertEqual(value_count, len(values)) self.assertEqual(value_count, len(values))
...@@ -237,7 +237,7 @@ class PageCyclerUnitTest(unittest.TestCase): ...@@ -237,7 +237,7 @@ class PageCyclerUnitTest(unittest.TestCase):
self.assertEqual(values[0].name, '%s.page_load_time' % chart_name) self.assertEqual(values[0].name, '%s.page_load_time' % chart_name)
self.assertEqual(values[0].units, 'ms') self.assertEqual(values[0].units, 'ms')
expected_values = ['gpu', 'renderer', 'browser'] expected_values = ['gpu', 'browser']
for value, expected in zip(values[1:len(expected_values) + 1], for value, expected in zip(values[1:len(expected_values) + 1],
expected_values): expected_values):
self.assertEqual(value.page, page) self.assertEqual(value.page, page)
......
...@@ -2,13 +2,17 @@ ...@@ -2,13 +2,17 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
from telemetry.page import page_test import time
from metrics import network from metrics import network
from metrics import power from metrics import power
from telemetry.core import util
from telemetry.page import page_test
class Power(page_test.PageTest): class Power(page_test.PageTest):
"""Measures power draw and idle wakeups during the page's interactions."""
def __init__(self): def __init__(self):
super(Power, self).__init__() super(Power, self).__init__()
self._power_metric = None self._power_metric = None
...@@ -29,3 +33,24 @@ class Power(page_test.PageTest): ...@@ -29,3 +33,24 @@ class Power(page_test.PageTest):
self._power_metric.Stop(page, tab) self._power_metric.Stop(page, tab)
self._network_metric.AddResults(tab, results) self._network_metric.AddResults(tab, results)
self._power_metric.AddResults(tab, results) self._power_metric.AddResults(tab, results)
class QuiescentPower(page_test.PageTest):
"""Measures power draw and idle wakeups after the page finished loading."""
# Amount of time to measure, in seconds.
SAMPLE_TIME = 30
def ValidateAndMeasurePage(self, page, tab, results):
if not tab.browser.platform.CanMonitorPower():
return
util.WaitFor(tab.HasReachedQuiescence, 60)
metric = power.PowerMetric(tab.browser.platform)
metric.Start(page, tab)
time.sleep(QuiescentPower.SAMPLE_TIME)
metric.Stop(page, tab)
metric.AddResults(tab, results)
...@@ -32,6 +32,12 @@ class CpuMetric(Metric): ...@@ -32,6 +32,12 @@ class CpuMetric(Metric):
def AddResults(self, tab, results, trace_name='cpu_utilization'): def AddResults(self, tab, results, trace_name='cpu_utilization'):
assert self._stop_cpu, 'Must call Stop() first' assert self._stop_cpu, 'Must call Stop() first'
cpu_stats = _SubtractCpuStats(self._stop_cpu, self._start_cpu) cpu_stats = _SubtractCpuStats(self._stop_cpu, self._start_cpu)
# FIXME: Renderer process CPU times are impossible to compare correctly.
# http://crbug.com/419786#c11
if 'Renderer' in cpu_stats:
del cpu_stats['Renderer']
# Add a result for each process type. # Add a result for each process type.
for process_type in cpu_stats: for process_type in cpu_stats:
trace_name_for_process = '%s_%s' % (trace_name, process_type.lower()) trace_name_for_process = '%s_%s' % (trace_name, process_type.lower())
......
...@@ -205,11 +205,6 @@ class Browser(app.App): ...@@ -205,11 +205,6 @@ class Browser(app.App):
result = self._GetStatsCommon(self._platform_backend.GetCpuStats) result = self._GetStatsCommon(self._platform_backend.GetCpuStats)
del result['ProcessCount'] del result['ProcessCount']
# FIXME: Renderer process CPU times are impossible to compare correctly.
# http://crbug.com/419786#c11
if 'Renderer' in result:
del result['Renderer']
# We want a single time value, not the sum for all processes. # We want a single time value, not the sum for all processes.
cpu_timestamp = self._platform_backend.GetCpuTimestamp() cpu_timestamp = self._platform_backend.GetCpuTimestamp()
for process_type in result: for process_type in result:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment