Skip to content

Commit 8e2ee06

Browse files
committed
Fix unexpected message ID suppression, and add stat for it
- `dnsperf`: - Count and report unexpected message IDs in statistics as indication that configured timeout might be too short - Fix nonsensical latency values produced by -O suppress=unexpected
1 parent 5f833aa commit 8e2ee06

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/dnsperf.c

+16-5
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ typedef struct {
119119
uint64_t num_interrupted;
120120
uint64_t num_timedout;
121121
uint64_t num_completed;
122+
uint64_t num_unexpected;
122123

123124
uint64_t total_request_size;
124125
uint64_t total_response_size;
@@ -284,6 +285,7 @@ diff_stats(const config_t* config, stats_t* last, stats_t* now, stats_t* diff)
284285
diff->num_interrupted = now->num_interrupted - last->num_interrupted;
285286
diff->num_timedout = now->num_timedout - last->num_timedout;
286287
diff->num_completed = now->num_completed - last->num_completed;
288+
diff->num_unexpected = now->num_unexpected - last->num_unexpected;
287289

288290
diff->total_request_size = now->total_request_size - last->total_request_size;
289291
diff->total_response_size = now->total_response_size - last->total_response_size;
@@ -381,6 +383,11 @@ print_statistics(const config_t* config, const times_t* times, stats_t* stats, u
381383
printf(" %s interrupted: %" PRIu64 " (%.2lf%%)\n",
382384
units, stats->num_interrupted,
383385
PERF_SAFE_DIV(100.0 * stats->num_interrupted, stats->num_sent));
386+
if (stats->num_unexpected > 0)
387+
printf(" Unexpected IDs: %" PRIu64 " (%.2lf%%)\n",
388+
stats->num_unexpected,
389+
PERF_SAFE_DIV(100.0 * stats->num_unexpected, stats->num_sent));
390+
384391
printf("\n");
385392

386393
printf(" Response codes: ");
@@ -500,6 +507,7 @@ sum_stats(const config_t* config, stats_t* total)
500507
total->num_interrupted += stats->num_interrupted;
501508
total->num_timedout += stats->num_timedout;
502509
total->num_completed += stats->num_completed;
510+
total->num_unexpected += stats->num_unexpected;
503511

504512
total->total_request_size += stats->total_request_size;
505513
total->total_response_size += stats->total_response_size;
@@ -1186,11 +1194,14 @@ do_recv(void* arg)
11861194
perf_log_warning("received short response");
11871195
continue;
11881196
}
1189-
if (recvd[i].unexpected && !tinfo->config->suppress.unexpected) {
1190-
perf_log_warning("received a response with an "
1191-
"unexpected (maybe timed out) "
1192-
"id: %u",
1193-
recvd[i].qid);
1197+
if (recvd[i].unexpected) {
1198+
if (!tinfo->config->suppress.unexpected) {
1199+
perf_log_warning("received a response with an "
1200+
"unexpected (maybe timed out) "
1201+
"id: %u",
1202+
recvd[i].qid);
1203+
}
1204+
stats->num_unexpected++;
11941205
continue;
11951206
}
11961207
latency = recvd[i].when - recvd[i].sent;

0 commit comments

Comments
 (0)