Skip to content

Commit

Permalink
redis-cli: fix latency result output
Browse files Browse the repository at this point in the history
(Cleaned up a little by @mattsta)

Closes #1774
  • Loading branch information
badboy authored and mattsta committed Aug 2, 2014
1 parent 0efac15 commit a159b1f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/redis-cli.c
Expand Up @@ -1850,11 +1850,15 @@ static void intrinsicLatencyMode(void) {
printf("Max latency so far: %lld microseconds.\n", max_latency);
}

double avg_us = (double)run_time/runs;
double avg_ns = avg_us * 10e3;
if (force_cancel_loop || end > test_end) {
printf("\n%lld total runs (avg %lld microseconds per run).\n",
runs, run_time/runs);
printf("Worst run took %.02fx times the average.\n",
(double) max_latency / (run_time/runs));
printf("\n%lld total runs "
"(avg latency: "
"%.4f microseconds (%.2f nanoseconds) per run).\n",
runs, avg_us, avg_ns);
printf("Worst run took %.0fx longer than the average latency.\n",
max_latency / avg_us);
exit(0);
}
}
Expand Down

0 comments on commit a159b1f

Please sign in to comment.