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 import re 6 from autotest_lib.client.bin import test 7 from autotest_lib.client.common_lib import error, utils 8 9 class platform_HighResTimers(test.test): 10 version = 1 11 12 def check_timers(self): 13 timer_list = open('/proc/timer_list') 14 for line in timer_list.readlines(): 15 match = re.search('^\s*\.resolution:\s(\d+)\s*nsecs$', line) 16 if match: 17 res = int(match.group(1)) 18 if (res != 1): 19 raise error.TestError('Timer resolution %d != 1 ns' % res) 20 21 def run_once(self): 22 try: 23 self.check_timers() 24 except error.TestError, e: 25 raise error.TestFail(e) 26