From 3e0eb42ae9027cbff1a44cfe52fa5c46d75f3c95 Mon Sep 17 00:00:00 2001 From: "Sahdev P. Zala" Date: Thu, 15 Feb 2018 14:48:16 -0500 Subject: [PATCH] etcdctl/check: create new check command for memory usage Create a new command similar to check perf that can check the memory consumption for putting different workloads on a given endpoint. If no endpoint is provided, localhost will be used. Return user with a message that whether there are enough memory for a given workload with pass or fail. Fixed #9121 --- etcdctl/ctlv3/command/check.go | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/etcdctl/ctlv3/command/check.go b/etcdctl/ctlv3/command/check.go index edeb630095ab..30652805a9ab 100644 --- a/etcdctl/ctlv3/command/check.go +++ b/etcdctl/ctlv3/command/check.go @@ -365,22 +365,15 @@ func newCheckDatascaleCommand(cmd *cobra.Command, args []string) { } bytesUsed := bytesAfter - bytesBefore + mbUsed := bytesUsed / (1024 * 1024) - ok = true if len(s.ErrorDist) != 0 { fmt.Println("FAIL: too many errors") for k, v := range s.ErrorDist { fmt.Printf("FAIL: ERROR(%v) -> %d\n", k, v) } - ok = false - } - - mbUsed := bytesUsed / (1024 * 1024) - - if ok { - fmt.Println(fmt.Sprintf("PASS: Approximate system memory used : %v MB.", strconv.FormatFloat(float64(mbUsed), 'f', 2, 64))) - } else { - fmt.Println("FAIL: Memory usage could not be determined.") os.Exit(ExitError) + } else { + fmt.Println(fmt.Sprintf("PASS: Approximate system memory used : %v MB.", strconv.FormatFloat(float64(mbUsed), 'f', 2, 64))) } }