diff options
Diffstat (limited to 'testsuites/sptests/spcpucounter01')
-rw-r--r-- | testsuites/sptests/spcpucounter01/init.c | 14 | ||||
-rw-r--r-- | testsuites/sptests/spcpucounter01/spcpucounter01.scn | 24 |
2 files changed, 29 insertions, 9 deletions
diff --git a/testsuites/sptests/spcpucounter01/init.c b/testsuites/sptests/spcpucounter01/init.c index 1ed8a582bd..c9f856d8c5 100644 --- a/testsuites/sptests/spcpucounter01/init.c +++ b/testsuites/sptests/spcpucounter01/init.c @@ -56,7 +56,7 @@ static void test_delay_nanoseconds(void) rtems_counter_ticks end; rtems_counter_ticks delta; double ns_per_tick = NS_PER_TICK; - double ns_delta; + uint64_t ns_delta; rtems_interval tick; int n = 10; int i; @@ -75,10 +75,20 @@ static void test_delay_nanoseconds(void) delta = rtems_counter_difference(end, start); ns_delta = rtems_counter_ticks_to_nanoseconds(delta); - rtems_test_assert(ns_delta >= ns_per_tick); + /* Special case for CPU counters using the clock driver counter */ + if (ns_delta < rtems_configuration_get_nanoseconds_per_tick()) { + printf( + "warning: the RTEMS counter seems to be unable to\n" + " measure intervals greater than the clock tick interval\n" + ); + + ns_delta += rtems_configuration_get_nanoseconds_per_tick(); + } printf( + "busy wait duration: %" PRIu64 "ns\n" "busy wait relative to clock tick: %f\n", + ns_delta, (ns_delta - ns_per_tick) / ns_per_tick ); } diff --git a/testsuites/sptests/spcpucounter01/spcpucounter01.scn b/testsuites/sptests/spcpucounter01/spcpucounter01.scn index fc8e84951e..62f86d7b64 100644 --- a/testsuites/sptests/spcpucounter01/spcpucounter01.scn +++ b/testsuites/sptests/spcpucounter01/spcpucounter01.scn @@ -2,14 +2,24 @@ CPU counter frequency: 25000000Hz nanoseconds for frequency count ticks: 1000000000 test delay nanoseconds (10 times) -busy wait relative to clock tick: 0.001320 -busy wait relative to clock tick: 0.001640 -busy wait relative to clock tick: 0.001320 -busy wait relative to clock tick: 0.001160 +busy wait duration: 1000840ns +busy wait relative to clock tick: 0.000840 +busy wait duration: 1001200ns +busy wait relative to clock tick: 0.001200 +busy wait duration: 1001480ns +busy wait relative to clock tick: 0.001480 +busy wait duration: 1001200ns +busy wait relative to clock tick: 0.001200 +busy wait duration: 1001120ns +busy wait relative to clock tick: 0.001120 +busy wait duration: 1001280ns busy wait relative to clock tick: 0.001280 +busy wait duration: 1001120ns +busy wait relative to clock tick: 0.001120 +busy wait duration: 1001240ns busy wait relative to clock tick: 0.001240 -busy wait relative to clock tick: 0.001280 -busy wait relative to clock tick: 0.001280 -busy wait relative to clock tick: 0.001320 +busy wait duration: 1001120ns +busy wait relative to clock tick: 0.001120 +busy wait duration: 1001280ns busy wait relative to clock tick: 0.001280 *** END OF TEST SPCPUCOUNTER 1 *** |