|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH RFC 18/59] controller: Add cpupool global config
From: George Dunlap <george.dunlap@xxxxxxxxxx>
Define WorkerConfig for worker configuration, add "Pool" as a pool in
which to place the worker (currently implemented in Xen only).
Add WorkerConfig options at the WorkerSet, BenchmarkRun, and
BenchmarkPlan levels; allow local levels to "override" global config
options.
The cpupool must already be defined.
Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxx>
---
benchmark.go | 19 ++++++++++++++++++-
main.go | 1 +
processworker.go | 2 +-
run.go | 16 +++++++++++-----
xenworker.go | 6 +++++-
5 files changed, 36 insertions(+), 8 deletions(-)
diff --git a/benchmark.go b/benchmark.go
index 4cc9d61..7fa83d2 100644
--- a/benchmark.go
+++ b/benchmark.go
@@ -46,14 +46,27 @@ type WorkerParams struct {
Args []string
}
+type WorkerConfig struct {
+ Pool string
+}
+
+// Propagate unset values from a higher level
+func (l *WorkerConfig) PropagateFrom(g WorkerConfig) {
+ if l.Pool == "" {
+ l.Pool = g.Pool
+ }
+}
+
+
type WorkerSet struct {
Params WorkerParams
+ Config WorkerConfig
Count int
}
type Worker interface {
SetId(WorkerId)
- Init(WorkerParams) error
+ Init(WorkerParams, WorkerConfig) error
Shutdown()
Process(chan WorkerReport, chan bool)
}
@@ -97,6 +110,7 @@ type BenchmarkRunData struct {
type BenchmarkRun struct {
Label string
WorkerSets []WorkerSet
+ WorkerConfig
RuntimeSeconds int
Completed bool
Results BenchmarkRunData
@@ -105,6 +119,9 @@ type BenchmarkRun struct {
type BenchmarkPlan struct {
filename string
WorkerType int
+ // Global options for workers that will be over-ridden by Run
+ // and WorkerSet config options
+ WorkerConfig
Runs []BenchmarkRun
}
diff --git a/main.go b/main.go
index f58068f..a931567 100644
--- a/main.go
+++ b/main.go
@@ -43,6 +43,7 @@ func main() {
plan := BenchmarkPlan{
WorkerType:WorkerXen,
+ WorkerConfig:WorkerConfig{Pool:"schedbench"},
filename:filename,
Runs:[]BenchmarkRun{
{Label:"baseline-a",
diff --git a/processworker.go b/processworker.go
index 5e26d81..f517321 100644
--- a/processworker.go
+++ b/processworker.go
@@ -38,7 +38,7 @@ func (w *ProcessWorker) SetId(i WorkerId) {
w.id = i
}
-func (w *ProcessWorker) Init(p WorkerParams) (err error) {
+func (w *ProcessWorker) Init(p WorkerParams, g WorkerConfig) (err error) {
w.c = exec.Command("./worker-proc", p.Args...)
w.stdout, err = w.c.StdoutPipe()
diff --git a/run.go b/run.go
index 762b408..9f1edcf 100644
--- a/run.go
+++ b/run.go
@@ -96,7 +96,7 @@ func NewWorkerList(WorkerSets []WorkerSet, workerType int)
(wl WorkerList, err e
ws.w.SetId(Id)
- ws.w.Init(WorkerSets[wsi].Params)
+ ws.w.Init(WorkerSets[wsi].Params,
WorkerSets[wsi].Config)
wl[Id] = ws
}
@@ -105,6 +105,10 @@ func NewWorkerList(WorkerSets []WorkerSet, workerType int)
(wl WorkerList, err e
}
func (run *BenchmarkRun) Run() (err error) {
+ for wsi := range run.WorkerSets {
+ run.WorkerSets[wsi].Config.PropagateFrom(run.WorkerConfig)
+ }
+
Workers, err := NewWorkerList(run.WorkerSets, WorkerXen)
if err != nil {
fmt.Println("Error creating workers: %v", err)
@@ -159,14 +163,16 @@ func (run *BenchmarkRun) Run() (err error) {
func (plan *BenchmarkPlan) Run() (err error) {
for i := range plan.Runs {
- if ! plan.Runs[i].Completed {
- fmt.Printf("Running test [%d] %s\n", i,
plan.Runs[i].Label)
- err = plan.Runs[i].Run()
+ r := &plan.Runs[i];
+ if ! r.Completed {
+ r.WorkerConfig.PropagateFrom(plan.WorkerConfig)
+ fmt.Printf("Running test [%d] %s\n", i, r.Label)
+ err = r.Run()
if err != nil {
return
}
}
- fmt.Printf("Test [%d] %s completed\n", i, plan.Runs[i].Label)
+ fmt.Printf("Test [%d] %s completed\n", i, r.Label)
err = plan.Save()
if err != nil {
fmt.Println("Error saving: ", err)
diff --git a/xenworker.go b/xenworker.go
index e14676c..4d42e5e 100644
--- a/xenworker.go
+++ b/xenworker.go
@@ -58,7 +58,7 @@ func (w *XenWorker) SetId(i WorkerId) {
w.domid = -1 // INVALID DOMID
}
-func (w *XenWorker) Init(p WorkerParams) (err error) {
+func (w *XenWorker) Init(p WorkerParams, g WorkerConfig) (err error) {
mock := false
// Make xl config file
@@ -80,6 +80,10 @@ func (w *XenWorker) Init(p WorkerParams) (err error) {
fmt.Fprintf(cfg, "vcpus = 1\n")
fmt.Fprintf(cfg, "on_crash = 'destroy'\n")
+ if g.Pool != "" {
+ fmt.Fprintf(cfg, "pool = '%s'\n", g.Pool)
+ }
+
// xl create -p [filename]
{
--
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 |