| OLD | NEW |
| 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import time | 5 import time |
| 6 from autotest_lib.client.common_lib import error, site_power_status, utils | 6 from autotest_lib.client.bin import utils |
| 7 from autotest_lib.client.cros import cros_ui_test | 7 from autotest_lib.client.common_lib import error |
| 8 from autotest_lib.client.cros import cros_ui_test, power_status |
| 8 | 9 |
| 9 | 10 |
| 10 class power_Idle(cros_ui_test.UITest): | 11 class power_Idle(cros_ui_test.UITest): |
| 11 version = 1 | 12 version = 1 |
| 12 | 13 |
| 13 def warmup(self, warmup_time=60): | 14 def warmup(self, warmup_time=60): |
| 14 time.sleep(warmup_time) | 15 time.sleep(warmup_time) |
| 15 | 16 |
| 16 | 17 |
| 17 def run_once(self, idle_time=120): | 18 def run_once(self, idle_time=120): |
| 18 self.status = site_power_status.get_status() | 19 self.status = power_status.get_status() |
| 19 | 20 |
| 20 # initialize various interesting power related stats | 21 # initialize various interesting power related stats |
| 21 self._usb_stats = site_power_status.USBSuspendStats() | 22 self._usb_stats = power_status.USBSuspendStats() |
| 22 self._cpufreq_stats = site_power_status.CPUFreqStats() | 23 self._cpufreq_stats = power_status.CPUFreqStats() |
| 23 self._cpuidle_stats = site_power_status.CPUIdleStats() | 24 self._cpuidle_stats = power_status.CPUIdleStats() |
| 24 | 25 |
| 25 | 26 |
| 26 time.sleep(idle_time) | 27 time.sleep(idle_time) |
| 27 self.status.refresh() | 28 self.status.refresh() |
| 28 | 29 |
| 29 | 30 |
| 30 def postprocess_iteration(self): | 31 def postprocess_iteration(self): |
| 31 keyvals = {} | 32 keyvals = {} |
| 32 | 33 |
| 33 # refresh power related statistics | 34 # refresh power related statistics |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 keyvals['ah_charge_now'] = self.status.battery[0].charge_now | 67 keyvals['ah_charge_now'] = self.status.battery[0].charge_now |
| 67 keyvals['a_current_now'] = self.status.battery[0].current_now | 68 keyvals['a_current_now'] = self.status.battery[0].current_now |
| 68 keyvals['wh_energy'] = self.status.battery[0].energy | 69 keyvals['wh_energy'] = self.status.battery[0].energy |
| 69 keyvals['w_energy_rate'] = self.status.battery[0].energy_rate | 70 keyvals['w_energy_rate'] = self.status.battery[0].energy_rate |
| 70 keyvals['h_remaining_time'] = self.status.battery[0].remaining_time | 71 keyvals['h_remaining_time'] = self.status.battery[0].remaining_time |
| 71 keyvals['v_voltage_min_design'] = \ | 72 keyvals['v_voltage_min_design'] = \ |
| 72 self.status.battery[0].voltage_min_design | 73 self.status.battery[0].voltage_min_design |
| 73 keyvals['v_voltage_now'] = self.status.battery[0].voltage_now | 74 keyvals['v_voltage_now'] = self.status.battery[0].voltage_now |
| 74 | 75 |
| 75 self.write_perf_keyval(keyvals) | 76 self.write_perf_keyval(keyvals) |
| OLD | NEW |