• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1NAME = 'monotonic_time'
2AUTHOR = 'Michael Davidson <md@google.com>'
3TIME = 'MEDIUM'
4TEST_CLASS = 'Kernel'
5TEST_CATEGORY = 'Functional'
6TEST_TYPE = 'client'
7DOC = """
8monotonic_time checks various time interfaces:
9  gettimeofday()
10  clock_gettime(CLOCK_MONTONIC)
11  TSC
12for monotonicity.
13
14Based on time-warp-test.c by Ingo Molnar.
15"""
16
17#
18# Test gettimeofday(), TSC, and clock_gettime(CLOCK_MONOTONIC)
19#
20# Tests run for 'duration' seconds and check that the selected
21# time interface does not go backwards by more than 'threshold'.
22#
23# Note that the threshold value has the same resolution as the
24# clock source:
25#   gettimeofday()                 - microseconds
26#   clock_gettime(CLOCK_MONOTONIC) - nanoseconds
27#   TSC                            - CPU clock cycles
28#
29#
30job.run_test('monotonic_time', tag='gtod',  test_type='gtod',
31             duration=300, threshold=0)
32
33job.run_test('monotonic_time', tag='clock', test_type='clock',
34             duration=300, threshold=0)
35
36job.run_test('monotonic_time', tag='tsc',   test_type='tsc',
37             duration=300, threshold=0)
38