| Index: tools/telemetry/telemetry/internal/platform/power_monitor/cros_power_monitor.py
|
| diff --git a/tools/telemetry/telemetry/internal/platform/power_monitor/cros_power_monitor.py b/tools/telemetry/telemetry/internal/platform/power_monitor/cros_power_monitor.py
|
| index 586a2985682718a4c1f7d7d9d32b7b5903556fb2..9a0ff1b8e6b4e4b6cb56a585bb5b346c3280822d 100644
|
| --- a/tools/telemetry/telemetry/internal/platform/power_monitor/cros_power_monitor.py
|
| +++ b/tools/telemetry/telemetry/internal/platform/power_monitor/cros_power_monitor.py
|
| @@ -3,7 +3,6 @@
|
| # found in the LICENSE file.
|
|
|
| import collections
|
| -import logging
|
| import re
|
|
|
| from telemetry import decorators
|
| @@ -33,17 +32,13 @@
|
| return super(CrosPowerMonitor, self).CanMonitorPower()
|
|
|
| def StartMonitoringPower(self, browser):
|
| - self._CheckStart()
|
| + super(CrosPowerMonitor, self).StartMonitoringPower(browser)
|
| if self._IsOnBatteryPower():
|
| sample = self._platform.RunCommand(['dump_power_status;', 'date', '+%s'])
|
| self._initial_power, self._start_time = CrosPowerMonitor.SplitSample(
|
| sample)
|
| - else:
|
| - logging.warning('Device not on battery power during power monitoring. '
|
| - 'Results may be incorrect.')
|
|
|
| def StopMonitoringPower(self):
|
| - self._CheckStop()
|
| cpu_stats = super(CrosPowerMonitor, self).StopMonitoringPower()
|
| power_stats = {}
|
| if self._IsOnBatteryPower():
|
| @@ -53,9 +48,6 @@
|
| length_h = (end_time - self._start_time) / 3600.0
|
| power_stats = CrosPowerMonitor.ParsePower(self._initial_power,
|
| final_power, length_h)
|
| - else:
|
| - logging.warning('Device not on battery power during power monitoring. '
|
| - 'Results may be incorrect.')
|
| return CrosPowerMonitor.CombineResults(cpu_stats, power_stats)
|
|
|
| @staticmethod
|
| @@ -134,6 +126,8 @@
|
| Returns:
|
| Dictionary in the format returned by StopMonitoringPower().
|
| """
|
| + out_dict = {'identifier': 'dump_power_status'}
|
| + component_utilization = {}
|
| initial = CrosPowerMonitor.ParsePowerStatus(initial_stats)
|
| final = CrosPowerMonitor.ParsePowerStatus(final_stats)
|
| # The charge value reported by 'dump_power_status' is not precise enough to
|
| @@ -142,6 +136,8 @@
|
| initial_power_mw = float(initial['battery_energy_rate']) * 10 ** 3
|
| final_power_mw = float(final['battery_energy_rate']) * 10 ** 3
|
| average_power_mw = (initial_power_mw + final_power_mw) / 2.0
|
| + out_dict['power_samples_mw'] = [initial_power_mw, final_power_mw]
|
| + out_dict['energy_consumption_mwh'] = average_power_mw * length_h
|
|
|
| # Duplicating CrOS battery fields where applicable.
|
| def CopyFinalState(field, key):
|
| @@ -158,7 +154,6 @@
|
| CopyFinalState('battery_energy_rate', 'energy_rate')
|
| CopyFinalState('battery_voltage', 'voltage_now')
|
|
|
| - return {'identifier': 'dump_power_status',
|
| - 'power_samples_mw': [initial_power_mw, final_power_mw],
|
| - 'energy_consumption_mwh': average_power_mw * length_h,
|
| - 'component_utilization': {'battery': battery}}
|
| + component_utilization['battery'] = battery
|
| + out_dict['component_utilization'] = component_utilization
|
| + return out_dict
|
|
|