From b79efef5d688b37c1bdf404f15e39bf36e7d6bd0 Mon Sep 17 00:00:00 2001 From: Madelyn Olson Date: Sun, 24 Feb 2019 00:12:00 +0000 Subject: [PATCH] Updated redis-benchmark so it doesn't show 1 value above 2ms at higher precision --- src/redis-benchmark.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/redis-benchmark.c b/src/redis-benchmark.c index 31f91eb0f..c7c4dfd3f 100644 --- a/src/redis-benchmark.c +++ b/src/redis-benchmark.c @@ -1,4 +1,4 @@ -/* Redis benchmark utility. +/* Redis benchmark utility. * * Copyright (c) 2009-2012, Salvatore Sanfilippo * All rights reserved. @@ -461,18 +461,18 @@ static void showLatencyReport(void) { if (config.latency[i]/usbetweenlat != curlat || i == (config.requests-1)) { - curlat = config.latency[i]/usbetweenlat; - perc = ((float)(i+1)*100)/config.requests; - printf("%.2f%% <= %.*f milliseconds\n", perc, config.precision, - curlat/pow(10.0, config.precision)); - /* After the 2 milliseconds latency to have percentages split * by decimals will just add a lot of noise to the output. */ - if (config.latency[i] > 2000) { + if (config.latency[i] >= 2000) { config.precision = 0; usbetweenlat = ipow(10, MAX_LATENCY_PRECISION-config.precision); } + + curlat = config.latency[i]/usbetweenlat; + perc = ((float)(i+1)*100)/config.requests; + printf("%.2f%% <= %.*f milliseconds\n", perc, config.precision, + curlat/pow(10.0, config.precision)); } } printf("%.2f requests per second\n\n", reqpersec);