• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3# found in the LICENSE file.
4
5import logging, time
6from autotest_lib.client.bin import test
7from autotest_lib.client.cros import power_status
8
9
10class power_StatsUSB(test.test):
11    version = 1
12
13
14    def run_once(self, test_time=60):
15        usb = power_status.USBSuspendStats()
16
17        # get USB percent active since boot
18        usb.incremental = False
19        stats = usb.refresh()
20        logging.info('USB active time since boot: %.2f%%', stats['active'])
21
22        # sleep for some time
23        time.sleep(test_time)
24
25        # get USB percent active during the test time
26        usb.incremental = True
27        stats = usb.refresh()
28        logging.info('USB active time in the last %d seconds: %.2f%%',
29                     test_time, stats['active'])
30