| OLD | NEW |
| 1 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2011 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 logging, os, shutil, time | 5 import logging, os, shutil, time |
| 6 from autotest_lib.client.bin import utils | 6 from autotest_lib.client.bin import utils |
| 7 from autotest_lib.client.common_lib import error | 7 from autotest_lib.client.common_lib import error |
| 8 from autotest_lib.client.cros import backchannel, cros_ui, cros_ui_test | 8 from autotest_lib.client.cros import backchannel, cros_ui, cros_ui_test |
| 9 from autotest_lib.client.cros import httpd, login, power_status | 9 from autotest_lib.client.cros import httpd, login, power_status |
| 10 from autotest_lib.client.cros import flimflam_test_path | 10 from autotest_lib.client.cros import flimflam_test_path |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 keyvals['v_voltage_min_design'] = \ | 227 keyvals['v_voltage_min_design'] = \ |
| 228 self._power_status.battery[0].voltage_min_design | 228 self._power_status.battery[0].voltage_min_design |
| 229 keyvals['v_voltage_now'] = self._power_status.battery[0].voltage_now | 229 keyvals['v_voltage_now'] = self._power_status.battery[0].voltage_now |
| 230 | 230 |
| 231 keyvals.update(self._tmp_keyvals) | 231 keyvals.update(self._tmp_keyvals) |
| 232 | 232 |
| 233 keyvals['a_current_rate'] = keyvals['ah_charge_used'] * 60 / \ | 233 keyvals['a_current_rate'] = keyvals['ah_charge_used'] * 60 / \ |
| 234 keyvals['minutes_battery_life'] | 234 keyvals['minutes_battery_life'] |
| 235 keyvals['w_energy_rate'] = keyvals['wh_energy_used'] * 60 / \ | 235 keyvals['w_energy_rate'] = keyvals['wh_energy_used'] * 60 / \ |
| 236 keyvals['minutes_battery_life'] | 236 keyvals['minutes_battery_life'] |
| 237 keyvals['w_min_temp'] = self._power_status.min_temp |
| 238 keyvals['w_max_temp'] = self._power_status.max_temp |
| 237 | 239 |
| 238 self.write_perf_keyval(keyvals) | 240 self.write_perf_keyval(keyvals) |
| 239 | 241 |
| 240 | 242 |
| 241 def cleanup(self): | 243 def cleanup(self): |
| 242 # remove json file after test to stop external extension launch. | 244 # remove json file after test to stop external extension launch. |
| 243 if self._json_path: | 245 if self._json_path: |
| 244 jsonfile = os.path.join(self._json_path, 'external_extensions.json') | 246 jsonfile = os.path.join(self._json_path, 'external_extensions.json') |
| 245 if os.path.exists(jsonfile): | 247 if os.path.exists(jsonfile): |
| 246 os.system('rm -f %s' % jsonfile) | 248 os.system('rm -f %s' % jsonfile) |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 # set backlight level to 40% of max | 332 # set backlight level to 40% of max |
| 331 cmd = 'backlight-tool --set_brightness %d ' % ( | 333 cmd = 'backlight-tool --set_brightness %d ' % ( |
| 332 int(self._max_backlight * 0.4)) | 334 int(self._max_backlight * 0.4)) |
| 333 os.system(cmd) | 335 os.system(cmd) |
| 334 | 336 |
| 335 # record brightness level | 337 # record brightness level |
| 336 cmd = 'backlight-tool --get_brightness' | 338 cmd = 'backlight-tool --get_brightness' |
| 337 level = int(utils.system_output(cmd).rstrip()) | 339 level = int(utils.system_output(cmd).rstrip()) |
| 338 logging.info('backlight level is %d' % level) | 340 logging.info('backlight level is %d' % level) |
| 339 self._tmp_keyvals['level_backlight_current'] = level | 341 self._tmp_keyvals['level_backlight_current'] = level |
| OLD | NEW |