Skip to content

Commit

Permalink
test: timer_perf: avoid modulo operation in a couple of loops
Browse files Browse the repository at this point in the history
Simplify a couple of loops and avoid a modulo operation.

Signed-off-by: Jere Leppänen <[email protected]>
  • Loading branch information
JereLeppanen committed Jan 5, 2024
1 parent 17c164b commit f64ff12
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions test/performance/odp_timer_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f64ff12

Please sign in to comment.