1 // the benchmark controller
3 package benchcontroller
13 type BenchControllerConfig struct {
24 func CreateController()(contConfig *BenchControllerConfig)
26 bcConfig := new(BenchControllerConfig);
31 func buildStatus(commOutStatus chan string, commInGoro chan string)
33 var statusBuffer string;
35 statusBuffer = "none:none";
39 case invar := <- commInGoro:
40 fmt.Printf("received a status update\n");
42 case commOutStatus <- statusBuffer:
43 fmt.Printf("send a status buffer\n");
49 func MainLoop(conf *BenchControllerConfig, commInChan chan string, commOutChan chan string, commOutStatus chan string)
52 comInGo := make(chan string);
54 go buildStatus(commOutStatus, comInGo);
59 fmt.Printf("coms: %s\n", i);
61 calls := strings.Split(i, ":", 0);
63 fmt.Printf("stuff 1: %s, stuff 2: %s\n", calls[0], calls[1]);
67 // this means shutdown
68 os.Stdout.WriteString("time for a conf\n");
74 conf.nclients, esink = strconv.Atoi(calls[7]);
75 conf.datamult, esink = strconv.Atoi(calls[6]);
77 if esink != os.ECHILD {
78 // i need to do something with esink or the bollocks compiler screws itself
80 conf.dbtype = calls[1];
81 conf.dbhost = calls[2];
82 conf.dbuser = calls[3];
83 conf.dbpass = calls[4];
84 conf.dbname = calls[5];
87 // get ready to bench - start the clients
88 os.Stdout.WriteString("ready clients\n");
90 comchan := make(chan int);
94 go dbconnector.DBSetup("mysql", conf.dbhost, conf.dbuser, conf.dbpass, conf.dbname, conf.datamult, comchan);
99 fmt.Printf("val: %d\n", val);
105 os.Stdout.WriteString("ok, im done\n");
108 os.Stdout.WriteString("start clients\n");