func RunCommandLine(concurrency int, iterations int, silent bool, name string, interval int, stop int, workload string) (err error) { handlers := make([]func(<-chan *Sample), 0) if !silent { handlers = append(handlers, func(s <-chan *Sample) { display(concurrency, iterations, interval, stop, s) }) } worker := benchmarker.NewWorker() worker.AddExperiment("login", experiments.Dummy) worker.AddExperiment("push", experiments.Push) worker.AddExperiment("dummy", experiments.Dummy) worker.AddExperiment("dummyWithErrors", experiments.DummyWithErrors) NewLaboratory(store.NewCsvStore("output/csvs")).RunWithHandlers( NewRunnableExperiment( NewExperimentConfiguration( iterations, concurrency, interval, stop, worker, workload)), handlers) for { in := make([]byte, 1) os.Stdin.Read(in) if string(in) == "q" { return nil } } return nil }
func RunCommandLine() error { lab := NewLaboratory(store.NewCsvStore("output/csvs")) worker := benchmarker.NewWorker() err := RunCommandLineWithLabAndWorker(lab, worker) for { in := make([]byte, 1) os.Stdin.Read(in) if string(in) == "q" { return err } } }
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 worker := benchmarker.NewWorker() worker.AddExperiment("login", experiments.Dummy) worker.AddExperiment("push", experiments.Push) worker.AddExperiment("dummy", experiments.Dummy) worker.AddExperiment("dummywitherrors", experiments.DummyWithErrors) experiment, _ := ctx.lab.Run( NewRunnableExperiment( NewExperimentConfiguration( pushes, concurrency, interval, stop, worker, workload))) return ctx.router.Get("experiment").URL("name", experiment.GetGuid()) }
) var _ = Describe("Cmdline", func() { var ( flags config.Config args []string lab *dummyLab worker benchmarker.Worker ) JustBeforeEach(func() { flags = config.NewConfig() InitCommandLineFlags(flags) flags.Parse(args) lab = &dummyLab{} worker = benchmarker.NewWorker() RunCommandLineWithLabAndWorker(lab, worker) }) Describe("When -iterations is supplied", func() { BeforeEach(func() { args = []string{"-iterations", "3"} }) It("configures the experiment with the parameter", func() { Ω(lab).Should(HaveBeenRunWith("iterations", 3)) }) }) Describe("When -concurrency is supplied", func() { BeforeEach(func() {