From 1557478b4706bcf32e28f69fc254bc9342e837a4 Mon Sep 17 00:00:00 2001 From: Jun He Date: Thu, 9 Nov 2017 10:10:20 -0600 Subject: [PATCH] Fix duration setting bug Before this fix, duration was always 5 seconds, regardless of the setting of '-duration'. The reason was that duration calculation was placed BEFORE flag.Parse(). --- main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 860909d..be172c2 100644 --- a/main.go +++ b/main.go @@ -72,10 +72,11 @@ func main() { conc := flag.Int("c", 4, "benchmark concurrency") qs := flag.String("queries", "hello world", "comma separated list of queries to benchmark") outfile := flag.String("o", "benchmark.csv", "results output file. set to - for stdout") - duration := time.Second * time.Duration(*seconds) cmdPrefix := flag.String("prefix", "FT", "Command prefix for FT module") - flag.Parse() + flag.Parse() + duration := time.Second * time.Duration(*seconds) + servers := strings.Split(*hosts, ",") if len(servers) == 0 { panic("No servers given")