Skip to content

Commit

Permalink
Reword connection statistics
Browse files Browse the repository at this point in the history
- Apply changes in 688a4fd to `resperf`
  • Loading branch information
jelu committed Sep 15, 2023
1 parent 688a4fd commit a80de21
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/dnsperf.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ diff_stats(const config_t* config, stats_t* last, stats_t* now, stats_t* diff)
diff->latency_min = 0; /* not enough data */
diff->latency_max = 0;

diff->num_conn_attempts = now->num_conn_attempts - last->num_conn_attempts;
diff->num_conn_attempts = now->num_conn_attempts - last->num_conn_attempts;
diff->num_conn_completed = now->num_conn_completed - last->num_conn_completed;

diff->conn_latency_sum = now->conn_latency_sum - last->conn_latency_sum;
Expand Down Expand Up @@ -1501,7 +1501,6 @@ static void perf__net_event(struct perf_net_socket* sock, perf_socket_event_t ev
stats->conn_latency_max = elapsed_time;
break;


case perf_socket_event_reconnecting:
case perf_socket_event_connecting:
stats->num_conn_attempts++;
Expand Down
14 changes: 10 additions & 4 deletions src/resperf.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ static uint64_t num_queries_outstanding;
static uint64_t num_responses_received;
static uint64_t num_queries_timed_out;
static uint64_t rcodecounts[16];
static uint64_t num_reconnections;
static uint64_t num_conn_completed;
static uint64_t num_conn_attempts;

static uint64_t time_now;
static uint64_t time_of_program_start;
Expand Down Expand Up @@ -489,10 +490,12 @@ static void perf__net_event(struct perf_net_socket* sock, perf_socket_event_t ev
case perf_socket_event_connected:
b->connections++;
b->conn_latency_sum += elapsed_time / (double)MILLION;
num_conn_completed++;
break;

case perf_socket_event_reconnecting:
num_reconnections++;
case perf_socket_event_connecting:
num_conn_attempts++;
break;

default:
Expand Down Expand Up @@ -545,8 +548,7 @@ print_statistics(void)
perf_dns_rcode_strings[i], rcodecounts[i],
(rcodecounts[i] * 100.0) / num_responses_received);
}
printf("\n");
printf(" Reconnection(s): %" PRIu64 "\n", num_reconnections);
printf("\n\n");
printf(" Run time (s): %u.%06u\n",
(unsigned int)(run_time / MILLION),
(unsigned int)(run_time % MILLION));
Expand All @@ -569,6 +571,10 @@ print_statistics(void)
printf(" Maximum throughput: %.6lf qps\n", max_throughput);
printf(" Lost at that point: %.2f%%\n", loss_at_max_throughput);
printf("\n");
printf(" Connection attempts: %" PRIu64 " (%" PRIu64 " successful, %.2lf%%)\n\n",
num_conn_attempts,
num_conn_completed,
PERF_SAFE_DIV(100.0 * num_conn_completed, num_conn_attempts));
}

/*
Expand Down

0 comments on commit a80de21

Please sign in to comment.