aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorJere Leppänen <jere.leppanen@nokia.com>2023-02-21 18:03:36 +0200
committerMatias Elo <matias.elo@nokia.com>2023-03-07 09:58:03 +0200
commitaf23071160cb188bbb3faa246d9df7bb7974e07f (patch)
tree8032d4620529983adec67b1f76391cf520db47ec /example
parent8db313825ed19c493b8f182afb76ec4a154ed09b (diff)
example: timer_accuracy: print final timeout error
Print the timing error for the final timeout. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
Diffstat (limited to 'example')
-rw-r--r--example/timer/odp_timer_accuracy.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/example/timer/odp_timer_accuracy.c b/example/timer/odp_timer_accuracy.c
index f015dc387..577e018c1 100644
--- a/example/timer/odp_timer_accuracy.c
+++ b/example/timer/odp_timer_accuracy.c
@@ -45,6 +45,8 @@ typedef struct {
uint64_t nsec_after_max;
uint64_t nsec_after_max_idx;
+ int64_t nsec_final;
+
uint64_t num_before;
uint64_t num_exact;
uint64_t num_after;
@@ -696,6 +698,9 @@ static void print_stat(test_global_t *test_global)
print_nsec_error("min", stat->nsec_before_min, res_ns, stat->nsec_before_min_idx);
print_nsec_error("max", stat->nsec_before_max, res_ns, stat->nsec_before_max_idx);
print_nsec_error("ave", ave_before, res_ns, UINT64_MAX);
+ printf(" final timeout error (nsec):\n");
+ printf(" %12" PRIi64 " / %.3fx resolution\n",
+ stat->nsec_final, (double)stat->nsec_final / res_ns);
printf("\n");
}
@@ -771,6 +776,7 @@ static void run_test(test_global_t *test_global)
tmo_ns += ctx->count * period + .5;
ctx->count++;
}
+ stat->nsec_final = (int64_t)time_ns - (int64_t)tmo_ns;
if (log)
log[i].tmo_ns = tmo_ns;