Home | History | Annotate | Download | only in power_StatsCPUFreq
      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 class power_StatsCPUFreq(test.test):
     11     version = 1
     12 
     13 
     14     def run_once(self, test_time=60):
     15         cpufreq_stats = power_status.CPUFreqStats()
     16 
     17         # log CPU frequency stats since boot
     18         cpufreq_stats.incremental = False
     19         current_stats = cpufreq_stats.refresh()
     20         logging.info('CPUFreq stats since boot:\n %s', current_stats)
     21 
     22         # sleep for some time to allow the system to go into idle state
     23         time.sleep(test_time)
     24 
     25         # get updated CPU frequency stats
     26         cpufreq_stats.incremental = True
     27         current_stats = cpufreq_stats.refresh()
     28         logging.info('CPUFreq stats in the last %d seconds :\n %s',
     29                      test_time, current_stats)
     30 
     31