1# Lint as: python2, python3 2# Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6import logging, time 7from autotest_lib.client.bin import test 8from autotest_lib.client.cros.power import power_status 9 10 11class power_StatsCPUFreq(test.test): 12 """ Gather CPU frequency statistics """ 13 version = 1 14 15 def run_once(self, test_time=60): 16 cpufreq_stats = power_status.CPUFreqStats() 17 18 # log CPU frequency stats since boot 19 cpufreq_stats.incremental = False 20 current_stats = cpufreq_stats.refresh() 21 logging.info('CPUFreq stats since boot:\n %s', current_stats) 22 23 # sleep for some time to allow the system to go into idle state 24 time.sleep(test_time) 25 26 # get updated CPU frequency stats 27 cpufreq_stats.incremental = True 28 current_stats = cpufreq_stats.refresh() 29 logging.info('CPUFreq stats in the last %d seconds :\n %s', 30 test_time, current_stats) 31