root.go 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright 2015 CoreOS, Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package cmd
  15. import (
  16. "sync"
  17. "github.com/coreos/etcd/Godeps/_workspace/src/github.com/cheggaaa/pb"
  18. "github.com/coreos/etcd/Godeps/_workspace/src/github.com/spf13/cobra"
  19. "github.com/coreos/etcd/pkg/transport"
  20. )
  21. // This represents the base command when called without any subcommands
  22. var RootCmd = &cobra.Command{
  23. Use: "benchmark",
  24. Short: "A low-level benchmark tool for etcd3",
  25. Long: `benchmark is a low-level benchmakr tool for etcd3.
  26. It uses gRPC client directly and does not depend on
  27. etcd client libray.
  28. `,
  29. }
  30. var (
  31. endpoints string
  32. totalConns uint
  33. totalClients uint
  34. bar *pb.ProgressBar
  35. results chan result
  36. wg sync.WaitGroup
  37. tls transport.TLSInfo
  38. cpuProfPath string
  39. memProfPath string
  40. )
  41. func init() {
  42. RootCmd.PersistentFlags().StringVar(&endpoints, "endpoint", "127.0.0.1:2378", "comma-separated gRPC endpoints")
  43. RootCmd.PersistentFlags().UintVar(&totalConns, "conns", 1, "Total number of gRPC connections")
  44. RootCmd.PersistentFlags().UintVar(&totalClients, "clients", 1, "Total number of gRPC clients")
  45. RootCmd.PersistentFlags().StringVar(&tls.CertFile, "cert", "", "identify HTTPS client using this SSL certificate file")
  46. RootCmd.PersistentFlags().StringVar(&tls.KeyFile, "key", "", "identify HTTPS client using this SSL key file")
  47. RootCmd.PersistentFlags().StringVar(&tls.CAFile, "cacert", "", "verify certificates of HTTPS-enabled servers using this CA bundle")
  48. }