| 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 logging, time | 5 import logging, time |
| 6 from autotest_lib.client.bin import test | 6 from autotest_lib.client.bin import test |
| 7 from autotest_lib.client.common_lib import site_power_status | 7 from autotest_lib.client.cros import power_status |
| 8 | 8 |
| 9 | 9 |
| 10 class power_StatsUSB(test.test): | 10 class power_StatsUSB(test.test): |
| 11 version = 1 | 11 version = 1 |
| 12 | 12 |
| 13 | 13 |
| 14 def run_once(self, test_time=60): | 14 def run_once(self, test_time=60): |
| 15 usb = site_power_status.USBSuspendStats() | 15 usb = power_status.USBSuspendStats() |
| 16 | 16 |
| 17 # get USB percent active since boot | 17 # get USB percent active since boot |
| 18 stats = usb.refresh(incremental=False) | 18 stats = usb.refresh(incremental=False) |
| 19 logging.info('USB active time since boot: %.2f%%', stats) | 19 logging.info('USB active time since boot: %.2f%%', stats) |
| 20 | 20 |
| 21 # sleep for some time | 21 # sleep for some time |
| 22 time.sleep(test_time) | 22 time.sleep(test_time) |
| 23 | 23 |
| 24 # get USB percent active during the test time | 24 # get USB percent active during the test time |
| 25 stats = usb.refresh() | 25 stats = usb.refresh() |
| 26 logging.info('USB active time in the last %d seconds: %.2f%%', | 26 logging.info('USB active time in the last %d seconds: %.2f%%', |
| 27 test_time, stats) | 27 test_time, stats) |
| OLD | NEW |