From 8ba41d5191e3b2893ce62e652412dd990be7ff69 Mon Sep 17 00:00:00 2001 From: "Sahdev P. Zala" Date: Tue, 8 May 2018 18:32:54 -0400 Subject: [PATCH] etcdctl/check: create progress bar for datascale Create a progress bar. The bar will show progress for a given workload. Fixes #9328 --- etcdctl/ctlv3/command/check.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/etcdctl/ctlv3/command/check.go b/etcdctl/ctlv3/command/check.go index f9b9cd65c9e..bd6d491f8ea 100644 --- a/etcdctl/ctlv3/command/check.go +++ b/etcdctl/ctlv3/command/check.go @@ -336,6 +336,10 @@ func newCheckDatascaleCommand(cmd *cobra.Command, args []string) { } fmt.Println(fmt.Sprintf("Start data scale check for work load [%v key-value pairs, %v bytes per key-value, %v concurrent clients].", cfg.limit, cfg.kvSize, cfg.clients)) + bar := pb.New(cfg.limit) + bar.Format("Bom !") + bar.Start() + for i := range clients { go func(c *v3.Client) { defer wg.Done() @@ -343,6 +347,7 @@ func newCheckDatascaleCommand(cmd *cobra.Command, args []string) { st := time.Now() _, derr := c.Do(context.Background(), op) r.Results() <- report.Result{Err: derr, Start: st, End: time.Now()} + bar.Increment() } }(clients[i]) } @@ -358,6 +363,7 @@ func newCheckDatascaleCommand(cmd *cobra.Command, args []string) { sc := r.Stats() wg.Wait() close(r.Results()) + bar.Finish() s := <-sc // get the process_resident_memory_bytes after the put operations