Skip to content

Commit

Permalink
librdmacm/cmtime: Report time for entire connect process
Browse files Browse the repository at this point in the history
In addition to reporting times for individual steps of the
connect process, time and report the time to establish the
full connection, from start to finish.

Signed-off-by: Sean Hefty <shefty@nvidia.com>
  • Loading branch information
shefty committed Apr 9, 2024
1 parent d05f337 commit d9385b5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion librdmacm/examples/cmtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ static int timeout = 2000;
static int retries = 2;

enum step {
STEP_FULL_CONNECT,
STEP_CREATE_ID,
STEP_BIND,
STEP_RESOLVE_ADDR,
Expand All @@ -77,6 +78,7 @@ enum step {
};

static const char *step_str[] = {
"full connect",
"create id",
"bind addr",
"resolve addr",
Expand All @@ -88,7 +90,7 @@ static const char *step_str[] = {
"rtr qp",
"rts qp attr",
"rts qp",
"connect",
"cm connect",
"establish",
"disconnect",
"destroy id",
Expand Down Expand Up @@ -235,6 +237,9 @@ static void show_perf(void)
min[i] = 0;
}

/* Reporting the 'sum' of the full connect is meaningless */
sum[STEP_FULL_CONNECT] = 0;

printf("step us/conn sum(us) max(us) min(us) total(us) avg/iter\n");
for (i = 0; i < STEP_CNT; i++) {
diff = (uint32_t) (times[i][1] - times[i][0]);
Expand Down Expand Up @@ -398,6 +403,7 @@ static void conn_handler(struct node *n)
n->error = 1;
endperf:
end_perf(n, STEP_CONNECT);
end_perf(n, STEP_FULL_CONNECT);
completed[STEP_CONNECT]++;
}

Expand Down Expand Up @@ -550,6 +556,7 @@ static int create_ids(void)
printf("\tCreating IDs\n");
start_time(STEP_CREATE_ID);
for (i = 0; i < connections; i++) {
start_perf(&nodes[i], STEP_FULL_CONNECT);
start_perf(&nodes[i], STEP_CREATE_ID);
ret = rdma_create_id(channel, &nodes[i].id, &nodes[i],
hints.ai_port_space);
Expand Down Expand Up @@ -688,6 +695,7 @@ static int client_connect(int iter)
return ret;
}

start_time(STEP_FULL_CONNECT);
ret = create_ids();
if (ret)
return ret;
Expand Down Expand Up @@ -779,6 +787,7 @@ static int client_connect(int iter)
while (started[STEP_CONNECT] != completed[STEP_CONNECT])
sched_yield();
end_time(STEP_CONNECT);
end_time(STEP_FULL_CONNECT);

printf("\tDisconnecting\n");
start_time(STEP_DISCONNECT);
Expand Down

0 comments on commit d9385b5

Please sign in to comment.