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

Unified Diff: tools/telemetry/telemetry/core/platform/power_monitor/cros_power_monitor.py

Issue 499563004: [Telemetry] CPU stats are added to results and always reported on CrOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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/metrics/power.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/core/platform/power_monitor/cros_power_monitor.py
diff --git a/tools/telemetry/telemetry/core/platform/power_monitor/cros_power_monitor.py b/tools/telemetry/telemetry/core/platform/power_monitor/cros_power_monitor.py
index 61afeb7748d29e8ca736a45b94fc2eb7b36c6d7a..c4cb9e85981c46da235553c27dda007ace245cd5 100644
--- a/tools/telemetry/telemetry/core/platform/power_monitor/cros_power_monitor.py
+++ b/tools/telemetry/telemetry/core/platform/power_monitor/cros_power_monitor.py
@@ -35,22 +35,25 @@ class CrosPowerMonitor(sysfs_power_monitor.SysfsPowerMonitor):
@decorators.Cache
def CanMonitorPower(self):
- return self._IsOnBatteryPower()
+ return super(CrosPowerMonitor, self).CanMonitorPower()
def StartMonitoringPower(self, browser):
super(CrosPowerMonitor, self).StartMonitoringPower(browser)
- self._initial_power = self._cri.RunCmdOnDevice(['power_supply_info'])[0]
- self._start_time = int(self._cri.RunCmdOnDevice(['date', '+%s'])[0])
+ if self._IsOnBatteryPower():
+ self._initial_power = self._cri.RunCmdOnDevice(['power_supply_info'])[0]
+ self._start_time = int(self._cri.RunCmdOnDevice(['date', '+%s'])[0])
def StopMonitoringPower(self):
cpu_stats = super(CrosPowerMonitor, self).StopMonitoringPower()
- final_power = self._cri.RunCmdOnDevice(['power_supply_info'])[0]
- self._end_time = int(self._cri.RunCmdOnDevice(['date', '+%s'])[0])
- # The length of the test is used to measure energy consumption.
- length_h = (self._end_time - self._start_time) / 3600.0
- power_stats = CrosPowerMonitor.ParsePower(
- self._initial_power, final_power, length_h)
- return super(CrosPowerMonitor, self).CombineResults(cpu_stats, power_stats)
+ power_stats = {}
+ if self._IsOnBatteryPower():
+ final_power = self._cri.RunCmdOnDevice(['power_supply_info'])[0]
+ self._end_time = int(self._cri.RunCmdOnDevice(['date', '+%s'])[0])
+ # The length of the test is used to measure energy consumption.
+ length_h = (self._end_time - self._start_time) / 3600.0
+ power_stats = CrosPowerMonitor.ParsePower(self._initial_power,
+ final_power, length_h)
+ return CrosPowerMonitor.CombineResults(cpu_stats, power_stats)
@staticmethod
def IsOnBatteryPower(status, board):
« no previous file with comments | « tools/perf/metrics/power.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698