From f64ff1223a5a2a532ff9502b4a6296b060cf2a02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jere=20Lepp=C3=A4nen?= Date: Fri, 5 Jan 2024 14:22:52 +0200 Subject: [PATCH] test: timer_perf: avoid modulo operation in a couple of loops MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simplify a couple of loops and avoid a modulo operation. Signed-off-by: Jere Leppänen --- test/performance/odp_timer_perf.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/test/performance/odp_timer_perf.c b/test/performance/odp_timer_perf.c index 16e2cb151a5..43eaa0625b9 100644 --- a/test/performance/odp_timer_perf.c +++ b/test/performance/odp_timer_perf.c @@ -667,10 +667,7 @@ static int cancel_timers(test_global_t *global, uint32_t worker_idx) int ret = 0; for (i = 0; i < num_tp; i++) { - for (j = 0; j < num_timer; j++) { - if ((j % num_worker) != worker_idx) - continue; - + for (j = worker_idx; j < num_timer; j += num_worker) { timer = global->timer[i][j]; if (timer == ODP_TIMER_INVALID) continue; @@ -783,10 +780,7 @@ static int set_cancel_mode_worker(void *arg) tick = odp_timer_current_tick(tp) + start_tick; - for (j = 0; j < num_timer; j++) { - if ((j % num_worker) != worker_idx) - continue; - + for (j = worker_idx; j < num_timer; j += num_worker) { timer = global->timer[i][j]; if (timer == ODP_TIMER_INVALID) continue;