[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH RFC 55/59] plan: Make the matrix generation more programmatic
From: George Dunlap <george.dunlap@xxxxxxxxxx> Rather than have nested loops, keep a running list of all the configs we've created so far. Then for each existing new element of the matrix, combine it with all the existing columns. Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxx> --- plan.go | 50 +++++++++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/plan.go b/plan.go index e535603..736d9f3 100644 --- a/plan.go +++ b/plan.go @@ -72,7 +72,9 @@ func (plan *BenchmarkPlan) ExpandInput() (err error) { schedulers = append(schedulers, "") } - // Always do the baselines + // Start by making a slice with baselines and each of the counts + var a, b []BenchmarkRun + for _, wn := range plan.Input.SimpleMatrix.Workers { wp := WorkerPresets[wn] @@ -85,39 +87,49 @@ func (plan *BenchmarkPlan) ExpandInput() (err error) { WorkerSets:[]WorkerSet{{Params:wp, Count:1}}, RuntimeSeconds:10, } - - for _, s := range schedulers { - fmt.Printf("Making baseline %s run, sched %s\n", wn, s) - run.RunConfig.Scheduler = s - run.Label = wn+" baseline "+s - plan.Runs = append(plan.Runs, run) - } + + run.Label = wn+" baseline" + a = append(a, run) } - + + for _, c := range plan.Input.SimpleMatrix.Count { run := BenchmarkRun{ RuntimeSeconds:10, } - var label string for _, wn := range plan.Input.SimpleMatrix.Workers { wp := WorkerPresets[wn] - if label != "" { - label = label+" + " + if run.Label != "" { + run.Label = run.Label+" + " } - label = fmt.Sprintf("%s%s %d ", label, wn, c) - + run.Label = fmt.Sprintf("%s%s %d", run.Label, wn, c) + ws := WorkerSet{Params:wp, Count:c} run.WorkerSets = append(run.WorkerSets, ws) } - for _, s := range schedulers { - fmt.Printf("Making count %d run, sched %s\n", c, s) - run.RunConfig.Scheduler = s - run.Label = label+s - plan.Runs = append(plan.Runs, run) + + a = append(a, run) + } + + // ...then cross it by schedulers + if len(schedulers) > 0 { + for _, base := range a { + for _, s := range schedulers { + run := base + run.RunConfig.Scheduler = s + run.Label = run.Label+" "+s + b = append(b, run) + } } + a = b + b = nil } + for i := range a { + fmt.Printf("%s\n", a[i].Label) + } + plan.Runs = a; return } -- 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |