X-Git-Url: http://git.pjr.cc/?p=goDBhammer.git;a=blobdiff_plain;f=src%2Fbenchcontroller.go;h=5370173235729dc1019634c34abd4197bfff599e;hp=6bd48a34aba68659b656fa058ea243deaaed4d8f;hb=9b12ded071272846ea82adfcc94c6bc08e3aec74;hpb=4644c6698a7b6ce6fdb913c2efd170cba3ebec16 diff --git a/src/benchcontroller.go b/src/benchcontroller.go index 6bd48a3..5370173 100644 --- a/src/benchcontroller.go +++ b/src/benchcontroller.go @@ -6,11 +6,15 @@ import ( //"./dbconnector"; "fmt"; "time"; + "strings"; + "strconv"; + "os"; ) type BenchControllerConfig struct { id int; nclients int; + datamult int; dbtype string; dbhost string; dbuser string; @@ -33,17 +37,37 @@ func MainLoop(conf *BenchControllerConfig, commInChan chan string, commOutChan c fmt.Printf("coms: %s\n", i); - /*switch i { - case 1: + calls := strings.Split(i, ":", 0); + + fmt.Printf("stuff 1: %s, stuff 2: %s\n", calls[0], calls[1]); + + switch calls[0] { + case "configure": // this means shutdown - os.Stdout.WriteString("shutdown\n"); - return; - case 2: + os.Stdout.WriteString("time for a conf\n"); + conf.id = 0; + + + var esink os.Error; + + conf.nclients, esink = strconv.Atoi(calls[7]); + conf.datamult, esink = strconv.Atoi(calls[6]); + + if esink != os.ECHILD { + // i need to do something with esink or the bollocks compiler screws itself + } + conf.dbtype = calls[1]; + conf.dbhost = calls[2]; + conf.dbuser = calls[3]; + conf.dbpass = calls[4]; + conf.dbname = calls[5]; + + case "asdf": // get ready to bench - start the clients os.Stdout.WriteString("ready clients\n"); - case 3: + case "qwer": // start the clients os.Stdout.WriteString("start clients\n"); - }*/ + } } } \ No newline at end of file