func main() { switch opt { case "grpc": demogrpc.Stress(port, endpoint, keys, vals, connsN, clientsN) case "jsonrpc": demojsonrpc.Stress(port, endpoint, keys, vals) } }
func BenchmarkStress(b *testing.B) { b.StartTimer() b.ReportAllocs() oncebody := func() { switch opt { case "grpc": port := ":8000" endpoint := "localhost" + port demogrpc.Stress(port, endpoint, keys, vals, connsN, clientsN) case "jsonrpc": port := ":8001" endpoint := "localhost" + port demojsonrpc.Stress(port, endpoint, keys, vals) } } once.Do(oncebody) }