func (ctx *context) handlePush(w http.ResponseWriter, r *http.Request) (interface{}, error) { pushes, err := strconv.Atoi(r.FormValue("iterations")) if err != nil { pushes = 1 } concurrency, err := strconv.Atoi(r.FormValue("concurrency")) if err != nil { concurrency = 1 } interval, err := strconv.Atoi(r.FormValue("interval")) if err != nil { interval = 0 } stop, err := strconv.Atoi(r.FormValue("stop")) if err != nil { stop = 0 } workload := r.FormValue("workload") if workload == "" { workload = "push" } //ToDo (simon): interval and stop is 0, repeating at interval is not yet exposed in Web UI workloadList := workloads.DefaultWorkloadList() worker := benchmarker.NewWorker() workloadList.DescribeWorkloads(worker) experiment, _ := ctx.lab.Run( NewRunnableExperiment( NewExperimentConfiguration( pushes, concurrency, interval, stop, worker, workload))) return ctx.router.Get("experiment").URL("name", experiment.GetGuid()) }
TotalTime int64 Timestamp int64 } var params = struct { iterations int listWorkloads bool concurrency int silent bool output string workload string interval int stop int }{} var workloadList = workloads.DefaultWorkloadList() func InitCommandLineFlags(config config.Config) { config.IntVar(¶ms.iterations, "iterations", 1, "number of pushes to attempt") config.IntVar(¶ms.concurrency, "concurrency", 1, "max number of pushes to attempt in parallel") config.BoolVar(¶ms.silent, "silent", false, "true to run the commands and print output the terminal") config.StringVar(¶ms.output, "output", "", "if specified, writes benchmark results to a CSV file") config.StringVar(¶ms.workload, "workload", "gcf:push", "a comma-separated list of operations a user should issue (use -list-workloads to see available workload options)") config.IntVar(¶ms.interval, "interval", 0, "repeat a workload at n second interval, to be used with -stop") config.IntVar(¶ms.stop, "stop", 0, "stop a repeating interval after n second, to be used with -interval") config.BoolVar(¶ms.listWorkloads, "list-workloads", false, "Lists the available workloads") workloadList.DescribeParameters(config) store.DescribeParameters(config) } func RunCommandLine() error {