aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorPetri Savolainen <petri.savolainen@nokia.com>2021-01-08 11:04:42 +0200
committerPetri Savolainen <petri.savolainen@nokia.com>2021-01-12 09:41:21 +0200
commite4843f933bd561edb8ee54697fd10f64e6d027b6 (patch)
tree9a10d4fe9117ffb1cdf5a695a66c81e99a3645e3 /example
parentf5ec9e5866af913c9dd7d428f474d1ceaac85adb (diff)
example: timer_accuracy: log also exact timeouts
Write timeouts that arrive exactly also to the log. Diff_ns does not need to be written as the log is initialized to zero. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
Diffstat (limited to 'example')
-rw-r--r--example/timer/odp_timer_accuracy.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/example/timer/odp_timer_accuracy.c b/example/timer/odp_timer_accuracy.c
index 75b8864c5..458e6b63f 100644
--- a/example/timer/odp_timer_accuracy.c
+++ b/example/timer/odp_timer_accuracy.c
@@ -574,6 +574,9 @@ static void run_test(test_global_t *test_global)
ctx = odp_timeout_user_ptr(tmo);
tmo_ns = ctx->nsec;
+ if (log)
+ log[i].tmo_ns = tmo_ns;
+
if (time_ns > tmo_ns) {
diff_ns = time_ns - tmo_ns;
stat->num_after++;
@@ -582,10 +585,8 @@ static void run_test(test_global_t *test_global)
stat->nsec_after_min = diff_ns;
if (diff_ns > stat->nsec_after_max)
stat->nsec_after_max = diff_ns;
- if (log) {
- log[i].tmo_ns = tmo_ns;
+ if (log)
log[i].diff_ns = diff_ns;
- }
} else if (time_ns < tmo_ns) {
diff_ns = tmo_ns - time_ns;
@@ -595,10 +596,8 @@ static void run_test(test_global_t *test_global)
stat->nsec_before_min = diff_ns;
if (diff_ns > stat->nsec_before_max)
stat->nsec_before_max = diff_ns;
- if (log) {
- log[i].tmo_ns = tmo_ns;
+ if (log)
log[i].diff_ns = -diff_ns;
- }
} else {
stat->num_exact++;
}