tools/tm-bench: Remove testing flags from help (#1949)

This commit is contained in:
Dev Ojha
2018-07-10 22:54:59 -07:00
committed by Anton Kaliaev
parent f5ad8ef860
commit b980ef8bea

View File

@ -29,15 +29,16 @@ func main() {
var verbose bool var verbose bool
var outputFormat, broadcastTxMethod string var outputFormat, broadcastTxMethod string
flag.IntVar(&connections, "c", 1, "Connections to keep open per endpoint") flagSet := flag.NewFlagSet("tm-bench", flag.ExitOnError)
flag.IntVar(&duration, "T", 10, "Exit after the specified amount of time in seconds") flagSet.IntVar(&connections, "c", 1, "Connections to keep open per endpoint")
flag.IntVar(&txsRate, "r", 1000, "Txs per second to send in a connection") flagSet.IntVar(&duration, "T", 10, "Exit after the specified amount of time in seconds")
flag.IntVar(&txSize, "s", 250, "The size of a transaction in bytes.") flagSet.IntVar(&txsRate, "r", 1000, "Txs per second to send in a connection")
flag.StringVar(&outputFormat, "output-format", "plain", "Output format: plain or json") flagSet.IntVar(&txSize, "s", 250, "The size of a transaction in bytes.")
flag.StringVar(&broadcastTxMethod, "broadcast-tx-method", "async", "Broadcast method: async (no guarantees; fastest), sync (ensures tx is checked) or commit (ensures tx is checked and committed; slowest)") flagSet.StringVar(&outputFormat, "output-format", "plain", "Output format: plain or json")
flag.BoolVar(&verbose, "v", false, "Verbose output") flagSet.StringVar(&broadcastTxMethod, "broadcast-tx-method", "async", "Broadcast method: async (no guarantees; fastest), sync (ensures tx is checked) or commit (ensures tx is checked and committed; slowest)")
flagSet.BoolVar(&verbose, "v", false, "Verbose output")
flag.Usage = func() { flagSet.Usage = func() {
fmt.Println(`Tendermint blockchain benchmarking tool. fmt.Println(`Tendermint blockchain benchmarking tool.
Usage: Usage:
@ -46,13 +47,13 @@ Usage:
Examples: Examples:
tm-bench localhost:26657`) tm-bench localhost:26657`)
fmt.Println("Flags:") fmt.Println("Flags:")
flag.PrintDefaults() flagSet.PrintDefaults()
} }
flag.Parse() flagSet.Parse(os.Args[1:])
if flag.NArg() == 0 { if flagSet.NArg() == 0 {
flag.Usage() flagSet.Usage()
os.Exit(1) os.Exit(1)
} }
@ -72,7 +73,7 @@ Examples:
} }
logger = log.NewTMLoggerWithColorFn(log.NewSyncWriter(os.Stdout), colorFn) logger = log.NewTMLoggerWithColorFn(log.NewSyncWriter(os.Stdout), colorFn)
fmt.Printf("Running %ds test @ %s\n", duration, flag.Arg(0)) fmt.Printf("Running %ds test @ %s\n", duration, flagSet.Arg(0))
} }
if broadcastTxMethod != "async" && if broadcastTxMethod != "async" &&
@ -86,7 +87,7 @@ Examples:
} }
var ( var (
endpoints = strings.Split(flag.Arg(0), ",") endpoints = strings.Split(flagSet.Arg(0), ",")
client = tmrpc.NewHTTP(endpoints[0], "/websocket") client = tmrpc.NewHTTP(endpoints[0], "/websocket")
initialHeight = latestBlockHeight(client) initialHeight = latestBlockHeight(client)
) )