diff options
author | Jere Leppänen <jere.leppanen@nokia.com> | 2023-05-29 17:06:40 +0300 |
---|---|---|
committer | Petri Savolainen <petri.savolainen@nokia.com> | 2023-06-01 10:15:10 +0300 |
commit | b684efe827c7227d2f78184a662adb4b9a577067 (patch) | |
tree | 222446d452bae99f8c1e5d79a3f64d58f1ee2c0f /test/validation/api/time | |
parent | 2b94fbad865b69c01f03539cedd65eb972558aef (diff) |
validation: time: print time differences in global time sync test
Print the time differences as well as min, max and average in the
global time sync test. This makes the result of the test visible
beyond just pass or fail.
Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Diffstat (limited to 'test/validation/api/time')
-rw-r--r-- | test/validation/api/time/time.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/test/validation/api/time/time.c b/test/validation/api/time/time.c index b5ceaec04..22189ce03 100644 --- a/test/validation/api/time/time.c +++ b/test/validation/api/time/time.c @@ -765,19 +765,42 @@ static void time_test_global_sync(const int ctrl) CU_ASSERT(odph_thread_join(thread_tbl, num) == num); for (int s = 0; s < TIME_SAMPLES; s++) { + int min_idx = 0, max_idx = 0; uint64_t min = UINT64_MAX, max = 0; + double avg = 0; for (int i = 1; i < num + 1; i++) { uint64_t t = odp_time_to_ns(global_mem->time[i][s]); - if (t < min) + if (t < min) { min = t; - if (t > max) + min_idx = i; + } + } + + printf("\nround %d\nthread time diffs: ", s); + + for (int i = 1; i < num + 1; i++) { + uint64_t t = odp_time_to_ns(global_mem->time[i][s]) - min; + + printf("%" PRIu64 " ", t); + + if (t > max) { max = t; + max_idx = i; + } + + avg += t; } - CU_ASSERT(max - min < tolerance); + /* The min result itself is not included in the average. */ + avg /= num - 1; + printf("\nmin: %" PRIu64 " (tid %d) max diff: %" PRIu64 + " (tid %d) avg diff: %g", min, min_idx, max, max_idx, avg); + CU_ASSERT(max < tolerance); } + + printf("\n"); } static void time_test_global_sync_workers(void) |