aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPetri Savolainen <petri.savolainen@nokia.com>2022-11-23 11:21:14 +0200
committerPetri Savolainen <petri.savolainen@nokia.com>2022-11-28 17:10:24 +0200
commit50051bfda7d6a77b4c62b022d946220b9a2a8830 (patch)
treec9bb961be70af26b7c52d0ab881b146f79cdf9f0 /test
parent3edaaddbfd9de6a9c171298d94dfcd008761366b (diff)
test: sched_latency: use strict time stamps
Use odp_time_global_strict() instead of the basic version for better time stamp accuracy. Remove latency of time conversion from the measurement by saving raw time stamp data to the event. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
Diffstat (limited to 'test')
-rw-r--r--test/performance/odp_sched_latency.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/performance/odp_sched_latency.c b/test/performance/odp_sched_latency.c
index d4cbfda19..131f8b4ca 100644
--- a/test/performance/odp_sched_latency.c
+++ b/test/performance/odp_sched_latency.c
@@ -70,7 +70,7 @@ typedef enum {
/** Test event */
typedef struct {
- uint64_t ts; /**< Send timestamp */
+ odp_time_t time_stamp; /**< Send timestamp */
event_type_t type; /**< Message type */
int src_idx[NUM_PRIOS]; /**< Source ODP queue */
int prio; /**< Source queue priority */
@@ -398,6 +398,7 @@ static int join_groups(test_globals_t *globals, int thr)
*/
static int test_schedule(int thr, test_globals_t *globals)
{
+ odp_time_t time;
odp_event_t ev;
odp_buffer_t buf;
odp_queue_t src_queue;
@@ -425,7 +426,9 @@ static int test_schedule(int thr, test_globals_t *globals)
stats = &globals->core_stat[thr].prio[event->prio];
if (event->type == SAMPLE) {
- latency = odp_time_to_ns(odp_time_global()) - event->ts;
+ time = odp_time_global_strict();
+
+ latency = odp_time_to_ns(time) - odp_time_to_ns(event->time_stamp);
if (latency > stats->max)
stats->max = latency;
@@ -459,7 +462,7 @@ static int test_schedule(int thr, test_globals_t *globals)
dst_queue = globals->queue[event->prio][dst_idx];
if (event->type == SAMPLE)
- event->ts = odp_time_to_ns(odp_time_global());
+ event->time_stamp = odp_time_global_strict();
if (odp_queue_enq(dst_queue, ev)) {
ODPH_ERR("[%i] Queue enqueue failed.\n", thr);