//"./dbconnector";
"fmt";
"time";
+ "strings";
+ "strconv";
+ "os";
)
type BenchControllerConfig struct {
id int;
nclients int;
+ datamult int;
dbtype string;
dbhost string;
dbuser string;
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
func beginPage(c *http.Conn, req *http.Request)
{
- header(c);
- io.WriteString(c, "<h1>Starting hammer</h1>");
- //dbhost := req.FormValue("dbhost");
- //dbuser := req.FormValue("dbuser");
- //dbpass := req.FormValue("dbpass");
- //dbname := req.FormValue("dbname");
- //nthreads := req.FormValue("nthreads");
- //dbmult := req.FormValue("dbmult");
-
- footer(c);
+
+ if req.Method != "GET" {
+ http.Redirect(c, "/begin", 301);
+ } else {
+ header(c);
+ io.WriteString(c, "<h1>Starting hammer</h1>");
+ //dbhost := req.FormValue("dbhost");
+ //dbuser := req.FormValue("dbuser");
+ //dbpass := req.FormValue("dbpass");
+ //dbname := req.FormValue("dbname");
+ //nthreads := req.FormValue("nthreads");
+ //dbmult := req.FormValue("dbmult");
+
+ footer(c);
+ }
}
dbname := req.FormValue("dbname");
nthreads := req.FormValue("nthreads");
dbmult := req.FormValue("dbmult");
+ var dbtype string;
io.WriteString(c, "You are trying to perform a benchmark with the following values:<br>");
io.WriteString(c, "<table border=\"1\">");
io.WriteString(c, "<input type=\"submit\" name=\"Begin\" value=\"Begin\">");
io.WriteString(c, "</form>");
+ dbtype = "mysql";
+
footer(c);
- comout <- fmt.Sprintf("configure:%s:%s:%s:%s:%s:%s", dbhost, dbuser, dbpass, dbname, dbmult, nthreads);
+ comout <- fmt.Sprintf("configure:%s:%s:%s:%s:%s:%s:%s", dbtype, dbhost, dbuser, dbpass, dbname, dbmult, nthreads);
}