Skip to content

Commit

Permalink
Add stats for unexpected message IDs
Browse files Browse the repository at this point in the history
- `dnsperf`:
  - Count and report unexpected message IDs in statistics
    as indication that configured timeout might be too short
  • Loading branch information
pspacek committed Feb 1, 2023
1 parent 97c849c commit c55aad0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/dnsperf.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ typedef struct {
uint64_t num_interrupted;
uint64_t num_timedout;
uint64_t num_completed;
uint64_t num_unexpected;

uint64_t total_request_size;
uint64_t total_response_size;
Expand Down Expand Up @@ -284,6 +285,7 @@ diff_stats(const config_t* config, stats_t* last, stats_t* now, stats_t* diff)
diff->num_interrupted = now->num_interrupted - last->num_interrupted;
diff->num_timedout = now->num_timedout - last->num_timedout;
diff->num_completed = now->num_completed - last->num_completed;
diff->num_unexpected = now->num_unexpected - last->num_unexpected;

diff->total_request_size = now->total_request_size - last->total_request_size;
diff->total_response_size = now->total_response_size - last->total_response_size;
Expand Down Expand Up @@ -381,6 +383,11 @@ print_statistics(const config_t* config, const times_t* times, stats_t* stats, u
printf(" %s interrupted: %" PRIu64 " (%.2lf%%)\n",
units, stats->num_interrupted,
PERF_SAFE_DIV(100.0 * stats->num_interrupted, stats->num_sent));
if (stats->num_unexpected > 0)
printf(" Unexpected IDs: %" PRIu64 " (%.2lf%%)\n",
stats->num_unexpected,
PERF_SAFE_DIV(100.0 * stats->num_unexpected, stats->num_sent));

printf("\n");

printf(" Response codes: ");
Expand Down Expand Up @@ -500,6 +507,7 @@ sum_stats(const config_t* config, stats_t* total)
total->num_interrupted += stats->num_interrupted;
total->num_timedout += stats->num_timedout;
total->num_completed += stats->num_completed;
total->num_unexpected += stats->num_unexpected;

total->total_request_size += stats->total_request_size;
total->total_response_size += stats->total_response_size;
Expand Down Expand Up @@ -1193,6 +1201,7 @@ do_recv(void* arg)
"id: %u",
recvd[i].qid);
}
stats->num_unexpected++;
continue;
}
latency = recvd[i].when - recvd[i].sent;
Expand Down

0 comments on commit c55aad0

Please sign in to comment.