[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH RFC 34/59] controller: Make a useful config file
From: George Dunlap <george.dunlap@xxxxxxxxxx> Allow a simple "skeleton" config file which can be adapted for the particular use case. Have 'plan' expand this with the real benchmark plan. Include "sample.bench" as a template to modify. Also update the README.md accordingly. Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxx> --- Makefile | 4 +-- benchmark.go | 9 ++++--- main.go | 48 ++++++------------------------------ plan.go | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 93 insertions(+), 47 deletions(-) create mode 100644 plan.go diff --git a/Makefile b/Makefile index 6dee499..af55e0a 100644 --- a/Makefile +++ b/Makefile @@ -13,11 +13,11 @@ CGO_LIBS = -lyajl -lxenlight XENLIB_PATH ?= /build/hg/xen.git/dist/install/usr/local/lib/ CGO_LDFLAGS = -L$(XENLIB_PATH) -Wl,-rpath-link=$(XENLIB_PATH) $(CGO_LIBS) -schedbench: main.go processworker.go xenworker.go benchmark.go run.go libxl.go htmlreport.go +schedbench: main.go processworker.go xenworker.go benchmark.go run.go libxl.go htmlreport.go plan.go CGO_LDFLAGS="$(CGO_LDFLAGS)" CGO_CFLAGS="$(CGO_CFLAGS)" go build -o $@ $^ # FIXME: Do with dlopen instead -schedbench-report: main.go processworker.go xenworker_dummy.go benchmark.go run.go htmlreport.go +schedbench-report: main.go processworker.go xenworker_dummy.go benchmark.go run.go htmlreport.go plan.go go build -o $@ $^ .PHONY: clean diff --git a/benchmark.go b/benchmark.go index 8be00a0..31b3711 100644 --- a/benchmark.go +++ b/benchmark.go @@ -148,12 +148,13 @@ type BenchmarkRun struct { } type BenchmarkPlan struct { - filename string - WorkerType int + Input *PlanInput `json:",omitempty"` + filename string `json:",omitempty"` + WorkerType int `json:",omitempty"` // Global options for workers that will be over-ridden by Run // and WorkerSet config options - WorkerConfig - Runs []BenchmarkRun + WorkerConfig `json:",omitempty"` + Runs []BenchmarkRun `json:",omitempty"` } func (run *BenchmarkRun) checkSummary() (done bool, err error) { diff --git a/main.go b/main.go index 2aa8bae..059a54a 100644 --- a/main.go +++ b/main.go @@ -49,49 +49,15 @@ func main() { verbosity, _ = strconv.Atoi(Args[1]) Args = Args[2:] case "plan": - workerA := []string{"burnwait", "70", "200000"} - //workerB := []string{"burnwait", "10", "20000000"} - workerB := []string{"burnwait", "10", "300000", - "burnwait", "20", "300000", - "burnwait", "10", "300000", - "burnwait", "10", "300000", - "burnwait", "10", "300000", - "burnwait", "10", "300000", - "burnwait", "30", "300000", - } - - - plan := BenchmarkPlan{ - WorkerType:WorkerXen, - WorkerConfig:WorkerConfig{Pool:"schedbench"}, - filename:filename, - Runs:[]BenchmarkRun{ - {Label:"baseline-a", - WorkerSets:[]WorkerSet{ - {Params:WorkerParams{workerA}, - Count:1}}, - RuntimeSeconds:10,}, - {Label:"baseline-b", - WorkerSets:[]WorkerSet{ - {Params:WorkerParams{workerB}, - Count:1}}, - RuntimeSeconds:10,}, - }} - - for i := 1; i <= 16 ; i *= 2 { - label := fmt.Sprintf("%da+%db", i, i) - run := BenchmarkRun{ - Label:label, - WorkerSets:[]WorkerSet{ - {Params:WorkerParams{workerA}, - Count:i}, - {Params:WorkerParams{workerB}, - Count:i}}, - RuntimeSeconds:10} - plan.Runs = append(plan.Runs, run) + plan, err := LoadBenchmark(filename) + if err != nil { + fmt.Println("Loading benchmark ", filename, " ", err) + os.Exit(1) } - err := plan.Save() + plan.ExpandInput() + + err = plan.Save() if err != nil { fmt.Println("Saving plan ", filename, " ", err) os.Exit(1) diff --git a/plan.go b/plan.go new file mode 100644 index 0000000..2983e78 --- /dev/null +++ b/plan.go @@ -0,0 +1,79 @@ +package main + +import ( + "fmt" +) + +type PlanSimpleMatrix struct { + Schedulers []string + Workers []string + Count []int +} + +type PlanInput struct { + WorkerPresets map[string]WorkerParams + SimpleMatrix *PlanSimpleMatrix +} + +var WorkerPresets = map[string]WorkerParams{ + "P001":WorkerParams{[]string{"burnwait", "70", "200000"}}, +} + + +func (plan *BenchmarkPlan) ExpandInput() (err error) { + if plan.Runs != nil { + fmt.Printf("plan.Expand: Runs non-empty, not doing anything\n"); + return + } + + if plan.Input.SimpleMatrix == nil { + fmt.Printf("plan.Expand: SimpleMatrix nil, nothing to do\n"); + return + } + + for k := range plan.Input.WorkerPresets { + WorkerPresets[k] = plan.Input.WorkerPresets[k]; + } + + // Always do the baselines + for _, wn := range plan.Input.SimpleMatrix.Workers { + wp := WorkerPresets[wn] + + if wp.Args == nil { + err = fmt.Errorf("Invalid worker preset: %s", wn) + return + } + + run := BenchmarkRun{ + Label:wn+" baseline", + WorkerSets:[]WorkerSet{{Params:wp, Count:1}}, + RuntimeSeconds:10, + } + + plan.Runs = append(plan.Runs, 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+" + " + } + label = fmt.Sprintf("%s%s %d", label, wn, c) + + ws := WorkerSet{Params:wp, Count:c} + run.WorkerSets = append(run.WorkerSets, ws) + } + run.Label = label + + plan.Runs = append(plan.Runs, run) + } + + 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 |