@@ -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
@@ -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) {
@@ -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)
new file mode 100644
@@ -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
+}