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

Unified Diff: tools/perf/metrics/power.py

Issue 222413002: Adding dumpsys based power monitor for android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: W0212 warnings Created 6 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
« no previous file with comments | « tools/perf/measurements/smoothness_unittest.py ('k') | tools/telemetry/telemetry/core/platform/__init__.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/metrics/power.py
diff --git a/tools/perf/metrics/power.py b/tools/perf/metrics/power.py
index 1196dbf22171724550728c9260701e7ee3dcdc8d..76c55cebe6963a30a3f18d1c39afe61611f7a0f1 100644
--- a/tools/perf/metrics/power.py
+++ b/tools/perf/metrics/power.py
@@ -34,8 +34,8 @@ class PowerMetric(Metric):
if not self._running:
return
self._running = False
- self._results = self._browser.platform.StopMonitoringPowerAsync()
- if self._results: # StopMonitoringPowerAsync() can return None.
+ self._results = self._browser.platform.StopMonitoringPower()
+ if self._results: # StopMonitoringPower() can return None.
self._results['cpu_stats'] = (
_SubtractCpuStats(self._browser.cpu_stats, self._starting_cpu_stats))
@@ -45,7 +45,7 @@ class PowerMetric(Metric):
# Friendly informational messages if measurement won't run.
system_supports_power_monitoring = (
- factory.GetPlatformBackendForCurrentOS().CanMonitorPowerAsync())
+ factory.GetPlatformBackendForCurrentOS().CanMonitorPower())
if system_supports_power_monitoring:
if not PowerMetric.enabled:
logging.warning(
@@ -58,7 +58,7 @@ class PowerMetric(Metric):
if not PowerMetric.enabled:
return
- if not tab.browser.platform.CanMonitorPowerAsync():
+ if not tab.browser.platform.CanMonitorPower():
return
self._results = None
@@ -67,14 +67,14 @@ class PowerMetric(Metric):
# This line invokes top a few times, call before starting power measurement.
self._starting_cpu_stats = self._browser.cpu_stats
- self._browser.platform.StartMonitoringPowerAsync()
+ self._browser.platform.StartMonitoringPower(self._browser)
self._running = True
def Stop(self, _, tab):
if not PowerMetric.enabled:
return
- if not tab.browser.platform.CanMonitorPowerAsync():
+ if not tab.browser.platform.CanMonitorPower():
return
self._StopInternal()
@@ -110,6 +110,10 @@ def _SubtractCpuStats(cpu_stats, start_cpu_stats):
# Skip any process_types that are empty.
if (not cpu_stats[process_type]) or (not start_cpu_stats[process_type]):
continue
+ # Skip if IdleWakeupCount is not present.
+ if (('IdleWakeupCount' not in cpu_stats[process_type]) or
+ ('IdleWakeupCount' not in start_cpu_stats[process_type])):
+ continue
idle_wakeup_delta = (cpu_stats[process_type]['IdleWakeupCount'] -
start_cpu_stats[process_type]['IdleWakeupCount'])
cpu_delta[process_type] = idle_wakeup_delta
« no previous file with comments | « tools/perf/measurements/smoothness_unittest.py ('k') | tools/telemetry/telemetry/core/platform/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698