redis-cli: fix latency result output

(Cleaned up a little by @mattsta)

Closes #1774
This commit is contained in:
Jan-Erik Rediger 2014-05-23 00:26:40 +02:00 committed by antirez
parent 5b3930655f
commit 05676c5d16

View File

@ -1850,11 +1850,15 @@ static void intrinsicLatencyMode(void) {
printf("Max latency so far: %lld microseconds.\n", max_latency); 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) { if (force_cancel_loop || end > test_end) {
printf("\n%lld total runs (avg %lld microseconds per run).\n", printf("\n%lld total runs "
runs, run_time/runs); "(avg latency: "
printf("Worst run took %.02fx times the average.\n", "%.4f microseconds / %.2f nanoseconds per run).\n",
(double) max_latency / (run_time/runs)); runs, avg_us, avg_ns);
printf("Worst run took %.0fx longer than the average latency.\n",
max_latency / avg_us);
exit(0); exit(0);
} }
} }