summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-06-21 09:45:39 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-06-21 15:54:18 +0200
commit7222a65f0e2992b9f8dd556d9a72c79a2421fe3a (patch)
treefe9350d588a52da5c5715ea3b7224872dab5f804
parentarm/raspberrypi: Ensure that buffers used for VC mail box communication are s... (diff)
downloadrtems-7222a65f0e2992b9f8dd556d9a72c79a2421fe3a.tar.bz2
sptests/spcpucounter01: Resurrect workaround
Resurrect workaround accidentially removed by 3e2a3c49480b9888362d016dd202edd562d9e069.
-rw-r--r--testsuites/sptests/spcpucounter01/init.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/testsuites/sptests/spcpucounter01/init.c b/testsuites/sptests/spcpucounter01/init.c
index 3fe12b0b17..92f2e15c72 100644
--- a/testsuites/sptests/spcpucounter01/init.c
+++ b/testsuites/sptests/spcpucounter01/init.c
@@ -158,6 +158,25 @@ static void report_overhead(
);
}
+static uint64_t large_delta_to_ns(rtems_counter_ticks d)
+{
+ uint64_t ns;
+
+ ns = rtems_counter_ticks_to_nanoseconds(d);
+
+ /* Special case for CPU counters using the clock driver counter */
+ if (ns < 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 += rtems_configuration_get_nanoseconds_per_tick();
+ }
+
+ return ns;
+}
+
static void test_report(test_context *ctx)
{
double ns_per_tick = NS_PER_TICK;
@@ -169,7 +188,7 @@ static void test_report(test_context *ctx)
for (i = 0; i < N; ++i) {
d = rtems_counter_difference(ctx->delay_ns_t[i][1], ctx->delay_ns_t[i][0]);
- ns = rtems_counter_ticks_to_nanoseconds(d);
+ ns = large_delta_to_ns(d);
printf(
"ns busy wait duration: %" PRIu64 "ns\n"
@@ -186,7 +205,7 @@ static void test_report(test_context *ctx)
ctx->delay_ticks_t[i][1],
ctx->delay_ticks_t[i][0]
);
- ns = rtems_counter_ticks_to_nanoseconds(d);
+ ns = large_delta_to_ns(d);
printf(
"ticks busy wait duration: %" PRIu64 "ns\n"