[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH RFC 38/59] controller: Allow multiple schedulers in the same benchmark file



From: George Dunlap <george.dunlap@xxxxxxxxxx>

First, add a RunConfig element to BenchmarkRun, which contains a
(string) name of the scheduler for this run.

Add run.Ready(), which if RunConfig.Scheduler is non-null, will check
to see if the cpupool in which the VMs will run (either
WorkerConfig.Pool or PoolID 0) has the specified scheduler.

Finally, when expanding the SimpleMatrix plan, if
SimpleMatrix.Schedulers is non-emply, add it to the matrix of runs.
Put them next to each other so that it's easy to compare similar runs
on different schedulers.

Refactor schedbench.sh to account for this, and also update the
README.md.

Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxx>
---
 benchmark.go |  5 +++++
 plan.go      | 38 +++++++++++++++++++++++++++-----------
 run.go       | 59 +++++++++++++++++++++++++++++++++++++++++++++++++----------
 3 files changed, 81 insertions(+), 21 deletions(-)

diff --git a/benchmark.go b/benchmark.go
index 31b3711..b77b66b 100644
--- a/benchmark.go
+++ b/benchmark.go
@@ -138,10 +138,15 @@ type BenchmarkRunData struct {
        Summary []WorkerSetSummary  `json:",omitempty"`
 }
 
+type RunConfig struct {
+       Scheduler string
+}
+
 type BenchmarkRun struct {
        Label string
        WorkerSets []WorkerSet
        WorkerConfig
+       RunConfig
        RuntimeSeconds int
        Completed bool
        Results BenchmarkRunData 
diff --git a/plan.go b/plan.go
index 2983e78..24c6bd4 100644
--- a/plan.go
+++ b/plan.go
@@ -35,29 +35,42 @@ func (plan *BenchmarkPlan) ExpandInput() (err error) {
                WorkerPresets[k] = plan.Input.WorkerPresets[k];
        }
 
+       // Use named schedulers, or default to "" (which will use the
+       // current one)
+       var schedulers []string
+       if plan.Input.SimpleMatrix.Schedulers != nil {
+               schedulers = plan.Input.SimpleMatrix.Schedulers
+       } else {
+               schedulers = append(schedulers, "")
+       }
+
        // 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 _, 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)
+               }
        }
-
+               
        for _, c := range plan.Input.SimpleMatrix.Count {
                run := BenchmarkRun{
                        RuntimeSeconds:10,
                }
-
+               
                var label string
                for _, wn := range plan.Input.SimpleMatrix.Workers {
                        wp := WorkerPresets[wn]
@@ -65,14 +78,17 @@ func (plan *BenchmarkPlan) ExpandInput() (err error) {
                        if label != "" {
                                label = label+" + "
                        }
-                       label = fmt.Sprintf("%s%s %d", label, wn, c)
+                       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)
+               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)
+               }
        }
 
        return
diff --git a/run.go b/run.go
index 08a43ff..1a753bc 100644
--- a/run.go
+++ b/run.go
@@ -3,7 +3,7 @@
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
+ * published by the Free Software Foundation; version 2 of the
  * License only.
  *
  * This program is distributed in the hope that it will be useful, but
@@ -156,6 +156,38 @@ func getCpuHz() (err error) {
        return
 }
 
+func (run *BenchmarkRun) Ready() (ready bool, why string) {
+       // FIXME: Check WorkerType
+       // Skip this run if it's not the scheduler we want
+       if run.RunConfig.Scheduler != "" {
+               var pool CpupoolInfo
+               if run.WorkerConfig.Pool != "" {
+                       var found bool
+                       pool, found = 
Ctx.CpupoolFindByName(run.WorkerConfig.Pool)
+                       if !found {
+                               why = "cpupool error"
+                               return
+                       }
+               } else {
+                       // xl defaults to cpupool 0
+                       plist := Ctx.ListCpupool()
+                       if len(plist) > 0 {
+                               pool = plist[0]
+                       } else {
+                               why = "cpupool error"
+                               return
+                       }
+               }
+
+               if pool.Scheduler.String() != run.RunConfig.Scheduler {
+                       why = "scheduler != "+run.RunConfig.Scheduler
+                       return 
+               }
+       }
+       ready = true
+       return 
+}
+
 func (run *BenchmarkRun) Run() (err error) {
        for wsi := range run.WorkerSets {
                run.WorkerSets[wsi].Config.PropagateFrom(run.WorkerConfig)
@@ -238,20 +270,27 @@ func (plan *BenchmarkPlan) Run() (err error) {
        
        for i := range plan.Runs {
                r := &plan.Runs[i];
-               if ! r.Completed {
+               if ! r.Completed { 
                        r.WorkerConfig.PropagateFrom(plan.WorkerConfig)
-                       fmt.Printf("Running test [%d] %s\n", i, r.Label)
-                       err = r.Run()
+                       ready, why := r.Ready()
+                       if ready {
+                               fmt.Printf("Running test [%d] %s\n", i, r.Label)
+                               err = r.Run()
+                               if err != nil {
+                                       return
+                               }
+                       } else {
+                               fmt.Printf("Test [%d]: %s skipped (%s)\n", i, 
r.Label, why)
+                       }
+               }
+               if r.Completed {
+                       fmt.Printf("Test [%d] %s completed\n", i, r.Label)
+                       err = plan.Save()
                        if err != nil {
+                               fmt.Println("Error saving: ", err)
                                return
                        }
                }
-               fmt.Printf("Test [%d] %s completed\n", i, r.Label)
-               err = plan.Save()
-               if err != nil {
-                       fmt.Println("Error saving: ", err)
-                       return
-               }
        }
        return
 }
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.