1# Copyright (c) 2011 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# Note: this test is ported to hardware.HighResTimer Tast test. 6# Any change made here should be applied to the one in Tast, too. 7 8import re 9from autotest_lib.client.bin import test 10from autotest_lib.client.common_lib import error, utils 11 12class platform_HighResTimers(test.test): 13 version = 1 14 15 def check_timers(self): 16 timer_list = open('/proc/timer_list') 17 for line in timer_list.readlines(): 18 match = re.search('^\s*\.resolution:\s(\d+)\s*nsecs$', line) 19 if match: 20 res = int(match.group(1)) 21 if (res != 1): 22 raise error.TestError('Timer resolution %d != 1 ns' % res) 23 24 def run_once(self): 25 try: 26 self.check_timers() 27 except error.TestError, e: 28 raise error.TestFail(e) 29