Home | History | Annotate | Download | only in power_Status
      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 
      5 import logging, time
      6 from autotest_lib.client.bin import test
      7 from autotest_lib.client.cros.power import power_status
      8 
      9 
     10 
     11 class power_Status(test.test):
     12     version = 1
     13 
     14 
     15     def run_once(self):
     16         status = power_status.get_status()
     17         statomatic = power_status.StatoMatic()
     18         meas = [power_status.SystemPower(status.battery_path)]
     19         plog = power_status.PowerLogger(meas, seconds_period=1)
     20         tlog = power_status.TempLogger(None, seconds_period=1)
     21         plog.start()
     22         tlog.start()
     23         time.sleep(2)
     24 
     25         logging.info("battery_energy: %f" % status.battery[0].energy)
     26         logging.info("linepower_online: %s" % status.on_ac())
     27 
     28         keyvals = plog.calc()
     29         keyvals.update(tlog.calc())
     30         keyvals.update(statomatic.publish())
     31         for k in sorted(keyvals.keys()):
     32             logging.info("%s: %s" , k, keyvals[k])
     33         plog.save_results(self.resultsdir)
     34         tlog.save_results(self.resultsdir)
     35