summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--base/stats/events.cc2
-rw-r--r--base/stats/mysql.cc89
-rw-r--r--base/stats/mysql.hh2
-rw-r--r--configs/boot/client.netperf.maerts33
-rw-r--r--configs/boot/client.netperf.rr33
-rw-r--r--configs/boot/client.netperf.stream33
-rw-r--r--configs/boot/server.netperf17
-rw-r--r--dev/disk_image.cc2
8 files changed, 190 insertions, 21 deletions
diff --git a/base/stats/events.cc b/base/stats/events.cc
index ed25e2423..771927564 100644
--- a/base/stats/events.cc
+++ b/base/stats/events.cc
@@ -45,7 +45,7 @@ using namespace std;
namespace Stats {
-Tick EventStart = ULL(0xffffffffffffffff);
+Tick EventStart = ULL(0x7fffffffffffffff);
vector<string> event_ignore;
vector<vector<string> > ignore_tokens;
diff --git a/base/stats/mysql.cc b/base/stats/mysql.cc
index 4c2a60127..a749b573a 100644
--- a/base/stats/mysql.cc
+++ b/base/stats/mysql.cc
@@ -67,9 +67,16 @@ MySqlRun::connect(const string &host, const string &user, const string &passwd,
if (mysql.error)
panic("could not connect to database server\n%s\n", mysql.error);
+ mysql.query("LOCK TABLES runs WRITE");
+ if (mysql.error)
+ panic("could not lock tables\n%s\n", mysql.error);
+
remove(name);
- cleanup();
+// cleanup();
setup(name, sample, user, project);
+ mysql.query("UNLOCK TABLES");
+ if (mysql.error)
+ panic("could not unlock tables\n%s\n", mysql.error);
}
void
@@ -100,6 +107,8 @@ MySqlRun::remove(const string &name)
stringstream sql;
ccprintf(sql, "DELETE FROM runs WHERE rn_name=\"%s\"", name);
mysql.query(sql);
+ if (mysql.error)
+ panic("could not delete run\n%s\n", mysql.error);
}
void
@@ -195,13 +204,13 @@ SetupStat::setup()
mysql.query(select);
MySQL::Result result = mysql.store_result();
if (!result)
- panic("could not get a run\n%s\n", mysql.error);
+ panic("could not find stat\n%s\n", mysql.error);
assert(result.num_fields() == 16);
MySQL::Row row = result.fetch_row();
if (!row)
- panic("could not get a run\n%s\n", mysql.error);
+ panic("could not get stat row\n%s\n", mysql.error);
bool tb;
int8_t ti8;
@@ -274,33 +283,52 @@ SetupStat::setup()
unsigned
SetupBin(const string &bin)
{
- MySQL::Connection &mysql = MySqlDB.conn();
- assert(mysql.connected());
+ static map<string, int> binmap;
using namespace MySQL;
+ map<string,int>::const_iterator i = binmap.find(bin);
+ if (i != binmap.end())
+ return (*i).second;
+
+ Connection &mysql = MySqlDB.conn();
+ assert(mysql.connected());
+
+ mysql.query("LOCK TABLES bins WRITE");
+ if (mysql.error)
+ panic("could not lock bin table\n%s\n", mysql.error);
+
+ uint16_t bin_id;
+
stringstream select;
+ stringstream insert;
ccprintf(select, "SELECT bn_id FROM bins WHERE bn_name=\"%s\"", bin);
mysql.query(select);
MySQL::Result result = mysql.store_result();
if (result) {
assert(result.num_fields() == 1);
- Row row = result.fetch_row();
+ MySQL::Row row = result.fetch_row();
if (row) {
- uint16_t bin_id;
to_number(row[0], bin_id);
- return bin_id;
+ goto exit;
}
}
- stringstream insert;
ccprintf(insert, "INSERT INTO bins(bn_name) values(\"%s\")", bin);
mysql.query(insert);
if (mysql.error)
- panic("could not get a run\n%s\n", mysql.error);
+ panic("could not get a bin\n%s\n", mysql.error);
+
+ bin_id = mysql.insert_id();
+ binmap.insert(make_pair(bin, bin_id));
+
+ exit:
+ mysql.query("UNLOCK TABLES");
+ if (mysql.error)
+ panic("could not unlock tables\n%s\n", mysql.error);
- return mysql.insert_id();
+ return bin_id;
}
InsertData::InsertData()
@@ -322,13 +350,15 @@ InsertData::flush()
MySQL::Connection &mysql = MySqlDB.conn();
assert(mysql.connected());
mysql.query(query);
+ if (mysql.error)
+ panic("could not insert data\n%s\n", mysql.error);
}
query[0] = '\0';
size = 0;
first = true;
strcpy(query, "INSERT INTO "
- "data(dt_stat,dt_x,dt_y,dt_run,dt_sample,dt_bin,dt_data) "
+ "data(dt_stat,dt_x,dt_y,dt_run,dt_tick,dt_bin,dt_data) "
"values");
size = strlen(query);
}
@@ -347,7 +377,7 @@ InsertData::insert()
first = false;
size += sprintf(query + size, "(%u,%d,%d,%u,%llu,%u,\"%f\")",
- stat, x, y, MySqlDB.run(), (unsigned long long)sample,
+ stat, x, y, MySqlDB.run(), (unsigned long long)tick,
bin, data);
}
@@ -374,6 +404,8 @@ InsertSubData::setup()
stat, x, y, name, descr);
mysql.query(insert);
+// if (mysql.error)
+// panic("could not insert subdata\n%s\n", mysql.error);
}
void
@@ -387,13 +419,17 @@ InsertFormula(uint16_t stat, const string &formula)
stat, formula);
mysql.query(insert_formula);
+// if (mysql.error)
+// panic("could not insert formula\n%s\n", mysql.error);
stringstream insert_ref;
ccprintf(insert_ref,
"INSERT INTO formula_ref(fr_stat,fr_run) values(%d, %d)",
stat, MySqlDB.run());
- mysql.query(insert_ref);
+ mysql.query(insert_ref);
+// if (mysql.error)
+// panic("could not insert formula reference\n%s\n", mysql.error);
}
void
@@ -405,6 +441,8 @@ UpdatePrereq(uint16_t stat, uint16_t prereq)
ccprintf(update, "UPDATE stats SET st_prereq=%d WHERE st_id=%d",
prereq, stat);
mysql.query(update);
+ if (mysql.error)
+ panic("could not update prereq\n%s\n", mysql.error);
}
void
@@ -414,6 +452,17 @@ MySql::configure()
* set up all stats!
*/
using namespace Database;
+
+ MySQL::Connection &mysql = MySqlDB.conn();
+ mysql.query("LOCK TABLES "
+ "stats WRITE, "
+ "bins WRITE, "
+ "subdata WRITE, "
+ "formulas WRITE, "
+ "formula_ref WRITE");
+ if (mysql.error)
+ panic("could not lock tables\n%s\n", mysql.error);
+
stat_list_t::const_iterator i, end = stats().end();
for (i = stats().begin(); i != end; ++i)
(*i)->visit(*this);
@@ -429,6 +478,10 @@ MySql::configure()
}
}
+ mysql.query("UNLOCK TABLES");
+ if (mysql.error)
+ panic("could not unlock tables\n%s\n", mysql.error);
+
configured = true;
}
@@ -531,7 +584,7 @@ MySql::configure(const Vector2dData &data)
if (!data.subnames.empty()) {
InsertSubData subdata;
subdata.stat = statid;
- subdata.y = 0;
+ subdata.y = -1;
for (int i = 0; i < data.subnames.size(); ++i) {
subdata.x = i;
subdata.name = data.subnames[i];
@@ -544,7 +597,7 @@ MySql::configure(const Vector2dData &data)
if (!data.y_subnames.empty()) {
InsertSubData subdata;
subdata.stat = statid;
- subdata.x = 0;
+ subdata.x = -1;
subdata.descr = "";
for (int i = 0; i < data.y_subnames.size(); ++i) {
subdata.y = i;
@@ -562,6 +615,7 @@ MySql::configure(const FormulaData &data)
{
configure(data, "FORMULA");
insert(data.id, stat.setup());
+ InsertFormula(find(data.id), data.str());
}
void
@@ -591,7 +645,7 @@ MySql::output()
configure();
// store sample #
- newdata.sample = curTick;
+ newdata.tick = curTick;
if (bins().empty()) {
output(string(""));
@@ -722,7 +776,6 @@ MySql::output(const Vector2dData &data)
void
MySql::output(const FormulaData &data)
{
- InsertFormula(find(data.id), data.str());
}
/*
diff --git a/base/stats/mysql.hh b/base/stats/mysql.hh
index 5780009d7..fcbe8c5e0 100644
--- a/base/stats/mysql.hh
+++ b/base/stats/mysql.hh
@@ -76,7 +76,7 @@ class InsertData
MySqlRun *run;
public:
- uint64_t sample;
+ uint64_t tick;
double data;
uint16_t stat;
uint16_t bin;
diff --git a/configs/boot/client.netperf.maerts b/configs/boot/client.netperf.maerts
new file mode 100644
index 000000000..05517fcc5
--- /dev/null
+++ b/configs/boot/client.netperf.maerts
@@ -0,0 +1,33 @@
+#!/bin/sh
+SERVER=10.0.0.1
+CLIENT=10.0.0.2
+
+echo "setting up network..."
+ifconfig lo 127.0.0.1
+ifconfig eth0 $CLIENT
+
+echo -n "waiting for server..."
+/usr/bin/netcat -c -l -p 8000
+
+BINARY=/usr/bin/netperf
+TEST="TCP_MAERTS"
+SHORT_ARGS="-l -100k"
+LONG_ARGS="-k16384,0 -K16384,0 -- -m 65536 -M 65536 -s 262144 -S 262144"
+
+
+SHORT="$BINARY -H $SERVER -t $TEST $SHORT_ARGS"
+LONG="$BINARY -H $SERVER -t $TEST $LONG_ARGS"
+
+echo "starting test..."
+echo "netperf warmup"
+echo $SHORT
+eval $SHORT
+
+echo "netperf benchmark"
+echo $LONG
+/sbin/m5 ivlb 1
+/sbin/m5 resetstats
+/sbin/m5 dumpresetstats 2000000000 2000000000
+/sbin/m5 checkpoint 2000000000 2000000000
+eval $LONG
+/sbin/m5 exit
diff --git a/configs/boot/client.netperf.rr b/configs/boot/client.netperf.rr
new file mode 100644
index 000000000..1ecd44e88
--- /dev/null
+++ b/configs/boot/client.netperf.rr
@@ -0,0 +1,33 @@
+#!/bin/sh
+SERVER=10.0.0.1
+CLIENT=10.0.0.2
+
+echo "setting up network..."
+ifconfig lo 127.0.0.1
+ifconfig eth0 $CLIENT
+
+echo -n "waiting for server..."
+/usr/bin/netcat -c -l -p 8000
+
+BINARY=/usr/bin/netperf
+TEST="TCP_RR"
+SHORT_ARGS="-l -1k"
+LONG_ARGS="-k10000,0 -K10000,0"
+
+
+SHORT="$BINARY -H $SERVER -t $TEST $SHORT_ARGS"
+LONG="$BINARY -H $SERVER -t $TEST $LONG_ARGS"
+
+echo "starting test..."
+echo "netperf warmup"
+echo $SHORT
+eval $SHORT
+
+echo "netperf benchmark"
+echo $LONG
+/sbin/m5 ivlb 1
+/sbin/m5 resetstats
+/sbin/m5 dumpresetstats 2000000000 2000000000
+/sbin/m5 checkpoint 2000000000 2000000000
+eval $LONG
+/sbin/m5 exit
diff --git a/configs/boot/client.netperf.stream b/configs/boot/client.netperf.stream
new file mode 100644
index 000000000..925c0bbf6
--- /dev/null
+++ b/configs/boot/client.netperf.stream
@@ -0,0 +1,33 @@
+#!/bin/sh
+SERVER=10.0.0.1
+CLIENT=10.0.0.2
+
+echo "setting up network..."
+ifconfig lo 127.0.0.1
+ifconfig eth0 $CLIENT
+
+echo -n "waiting for server..."
+/usr/bin/netcat -c -l -p 8000
+
+BINARY=/usr/bin/netperf
+TEST="TCP_STREAM"
+SHORT_ARGS="-l -100k"
+LONG_ARGS="-k16384,0 -K16384,0 -- -m 65536 -M 65536 -s 262144 -S 262144"
+
+
+SHORT="$BINARY -H $SERVER -t $TEST $SHORT_ARGS"
+LONG="$BINARY -H $SERVER -t $TEST $LONG_ARGS"
+
+echo "starting test..."
+echo "netperf warmup"
+echo $SHORT
+eval $SHORT
+
+echo "netperf benchmark"
+echo $LONG
+/sbin/m5 ivlb 1
+/sbin/m5 resetstats
+/sbin/m5 dumpresetstats 2000000000 2000000000
+/sbin/m5 checkpoint 2000000000 2000000000
+eval $LONG
+/sbin/m5 exit
diff --git a/configs/boot/server.netperf b/configs/boot/server.netperf
new file mode 100644
index 000000000..d8b142bf7
--- /dev/null
+++ b/configs/boot/server.netperf
@@ -0,0 +1,17 @@
+#!/bin/sh
+SERVER=10.0.0.1
+CLIENT=10.0.0.2
+
+echo "setting up network..."
+ifconfig lo 127.0.0.1
+ifconfig eth0 $SERVER
+
+echo "running netserver..."
+/usr/bin/netserver
+
+echo -n "signal client to begin..."
+echo "server ready" | /usr/bin/netcat -c $CLIENT 8000
+echo "done."
+
+echo "starting bash..."
+exec /bin/bash
diff --git a/dev/disk_image.cc b/dev/disk_image.cc
index f9e1c2fe3..20e693d0d 100644
--- a/dev/disk_image.cc
+++ b/dev/disk_image.cc
@@ -427,7 +427,7 @@ CowDiskImage::serialize(ostream &os)
{
string cowFilename = name() + ".cow";
SERIALIZE_SCALAR(cowFilename);
- save(cowFilename);
+ save(Checkpoint::dir() + "/" + cowFilename);
}
void