| 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
|
|
|