Skip to content

Commit

Permalink
librdmacm/cmtime: Change how test iteration stages are tracked
Browse files Browse the repository at this point in the history
Replace the started != completed syntax with a simpler check that
completed != iterations to perform.  This removes the started
variable.

Signed-off-by: Sean Hefty <[email protected]>
  • Loading branch information
Sean Hefty committed Apr 16, 2024
1 parent 498d623 commit 21af2b3
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions librdmacm/examples/cmtime.c
Expand Up @@ -132,7 +132,6 @@ static uint64_t times[STEP_CNT][2];
static int connections;
static volatile int disc_events;

static volatile int started[STEP_CNT];
static volatile int completed[STEP_CNT];

static struct ibv_pd *pd;
Expand Down Expand Up @@ -376,8 +375,6 @@ static void connect_qp(struct node *n)
n->error = 1;
return;
}

started[STEP_CONNECT]++;
}

static void addr_handler(struct node *n)
Expand Down Expand Up @@ -670,7 +667,6 @@ static void reset_test(int iter)
connections = iter;

memset(times, 0, sizeof times);
memset((void *) started, 0, sizeof started);
memset((void *) completed, 0, sizeof completed);
memset(nodes, 0, sizeof(*nodes) * iter);
}
Expand Down Expand Up @@ -745,9 +741,8 @@ static int client_connect(int iter)
nodes[i].error = 1;
continue;
}
started[STEP_RESOLVE_ADDR]++;
}
while (started[STEP_RESOLVE_ADDR] != completed[STEP_RESOLVE_ADDR])
while (completed[STEP_RESOLVE_ADDR] != iter)
sched_yield();
end_time(STEP_RESOLVE_ADDR);

Expand All @@ -764,9 +759,8 @@ static int client_connect(int iter)
nodes[i].error = 1;
continue;
}
started[STEP_RESOLVE_ROUTE]++;
}
while (started[STEP_RESOLVE_ROUTE] != completed[STEP_RESOLVE_ROUTE])
while (completed[STEP_RESOLVE_ROUTE] != iter)
sched_yield();
end_time(STEP_RESOLVE_ROUTE);

Expand Down Expand Up @@ -799,7 +793,7 @@ static int client_connect(int iter)
continue;
connect_qp(&nodes[i]);
}
while (started[STEP_CONNECT] != completed[STEP_CONNECT])
while (completed[STEP_CONNECT] != iter)
sched_yield();
end_time(STEP_CONNECT);
end_time(STEP_FULL_CONNECT);
Expand All @@ -811,9 +805,8 @@ static int client_connect(int iter)
continue;
start_perf(&nodes[i], STEP_DISCONNECT);
rdma_disconnect(nodes[i].id);
started[STEP_DISCONNECT]++;
}
while (started[STEP_DISCONNECT] != completed[STEP_DISCONNECT])
while (completed[STEP_DISCONNECT] != iter)
sched_yield();
end_time(STEP_DISCONNECT);

Expand Down

0 comments on commit 21af2b3

Please sign in to comment.