summaryrefslogtreecommitdiff
path: root/src/base/stats
diff options
context:
space:
mode:
authorKorey Sewell <ksewell@umich.edu>2006-06-12 16:19:18 -0400
committerKorey Sewell <ksewell@umich.edu>2006-06-12 16:19:18 -0400
commitb0fc2c02af47c04650b981a28e2551bb7d07b426 (patch)
treeecd587c0228010f29bb1d5c376b2c19a77e4567f /src/base/stats
parent13d46e2075444fb4d9b36c766a7641a637f83dcf (diff)
parentbabb22eea4be07cbc725eea129c6a6557fd56af2 (diff)
downloadgem5-b0fc2c02af47c04650b981a28e2551bb7d07b426.tar.xz
Merge zizzer:/bk/newmem
into zizzer.eecs.umich.edu:/.automount/zooks/y/ksewell/research/m5-sim/newmem-release --HG-- extra : convert_revision : 18a381fa230f2ef6d027359ffd619e3ae75cd446
Diffstat (limited to 'src/base/stats')
-rw-r--r--src/base/stats/mysql.cc96
-rw-r--r--src/base/stats/mysql.hh3
-rw-r--r--src/base/stats/statdb.cc12
-rw-r--r--src/base/stats/statdb.hh6
-rw-r--r--src/base/stats/text.cc20
-rw-r--r--src/base/stats/text.hh1
6 files changed, 14 insertions, 124 deletions
diff --git a/src/base/stats/mysql.cc b/src/base/stats/mysql.cc
index fa4bcd5ee..0fb31f4ce 100644
--- a/src/base/stats/mysql.cc
+++ b/src/base/stats/mysql.cc
@@ -158,14 +158,6 @@ MySqlRun::cleanup()
if (mysql.commit())
panic("could not commit transaction\n%s\n", mysql.error);
- mysql.query("DELETE bins "
- "FROM bins "
- "LEFT JOIN data ON bn_id=dt_bin "
- "WHERE dt_bin IS NULL");
-
- if (mysql.commit())
- panic("could not commit transaction\n%s\n", mysql.error);
-
mysql.query("DELETE events"
"FROM events"
"LEFT JOIN runs ON ev_run=rn_id"
@@ -309,52 +301,6 @@ SetupStat::setup()
return statid;
}
-unsigned
-SetupBin(const string &bin)
-{
- 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());
-
- 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);
- MySQL::Row row = result.fetch_row();
- if (row) {
- to_number(row[0], bin_id);
- goto exit;
- }
- }
-
- ccprintf(insert, "INSERT INTO bins(bn_name) values(\"%s\")", bin);
-
- mysql.query(insert);
- if (mysql.error)
- panic("could not get a bin\n%s\n", mysql.error);
-
- bin_id = mysql.insert_id();
- if (mysql.commit())
- panic("could not commit transaction\n%s\n", mysql.error);
-
- binmap.insert(make_pair(bin, bin_id));
-
- exit:
- return bin_id;
-}
-
InsertData::InsertData()
{
query = new char[maxsize + 1];
@@ -384,7 +330,7 @@ InsertData::flush()
size = 0;
first = true;
strcpy(query, "INSERT INTO "
- "data(dt_stat,dt_x,dt_y,dt_run,dt_tick,dt_bin,dt_data) "
+ "data(dt_stat,dt_x,dt_y,dt_run,dt_tick,dt_data) "
"values");
size = strlen(query);
}
@@ -402,9 +348,9 @@ InsertData::insert()
first = false;
- size += sprintf(query + size, "(%u,%d,%d,%u,%llu,%u,\"%f\")",
+ size += sprintf(query + size, "(%u,%d,%d,%u,%llu,\"%f\")",
stat, x, y, MySqlDB.run(), (unsigned long long)tick,
- bin, data);
+ data);
}
struct InsertSubData
@@ -656,29 +602,6 @@ MySql::configure(const FormulaData &data)
InsertFormula(find(data.id), data.str());
}
-void
-MySql::output(MainBin *bin)
-{
- MySQL::Connection &mysql = MySqlDB.conn();
-
- if (bin) {
- bin->activate();
- newdata.bin = SetupBin(bin->name());
- } else {
- newdata.bin = 0;
- }
-
- Database::stat_list_t::const_iterator i, end = Database::stats().end();
- for (i = Database::stats().begin(); i != end; ++i) {
- StatData *stat = *i;
- if (bin && stat->binned() || !bin && !stat->binned()) {
- stat->visit(*this);
- if (mysql.commit())
- panic("could not commit transaction\n%s\n", mysql.error);
- }
- }
-}
-
bool
MySql::valid() const
{
@@ -697,11 +620,14 @@ MySql::output()
// store sample #
newdata.tick = curTick;
- output(NULL);
- if (!bins().empty()) {
- bin_list_t::iterator i, end = bins().end();
- for (i = bins().begin(); i != end; ++i)
- output(*i);
+ MySQL::Connection &mysql = MySqlDB.conn();
+
+ Database::stat_list_t::const_iterator i, end = Database::stats().end();
+ for (i = Database::stats().begin(); i != end; ++i) {
+ StatData *stat = *i;
+ stat->visit(*this);
+ if (mysql.commit())
+ panic("could not commit transaction\n%s\n", mysql.error);
}
newdata.flush();
diff --git a/src/base/stats/mysql.hh b/src/base/stats/mysql.hh
index 1d88fbcd9..50f7d9e97 100644
--- a/src/base/stats/mysql.hh
+++ b/src/base/stats/mysql.hh
@@ -39,7 +39,6 @@
namespace MySQL { class Connection; }
namespace Stats {
-class MainBin;
class DistDataData;
class MySqlRun;
bool MySqlConnected();
@@ -82,7 +81,6 @@ class InsertData
uint64_t tick;
double data;
uint16_t stat;
- uint16_t bin;
int16_t x;
int16_t y;
@@ -133,7 +131,6 @@ class MySql : public Output
protected:
// Output helper
- void output(MainBin *bin);
void output(const DistDataData &data);
void output(const ScalarData &data);
void output(const VectorData &data);
diff --git a/src/base/stats/statdb.cc b/src/base/stats/statdb.cc
index 682f62dc1..f9136807a 100644
--- a/src/base/stats/statdb.cc
+++ b/src/base/stats/statdb.cc
@@ -31,7 +31,6 @@
#include "base/misc.hh"
#include "base/trace.hh"
#include "base/statistics.hh"
-#include "base/stats/bin.hh"
#include "base/stats/statdb.hh"
using namespace std;
@@ -51,17 +50,6 @@ find(void *stat)
}
void
-regBin(MainBin *bin, const std::string &_name)
-{
- bin_list_t::iterator i, end = bins().end();
- for (i = bins().begin(); i != end; ++i)
- if ((*i)->name() == _name)
- panic("re-registering bin %s", _name);
- bins().push_back(bin);
- DPRINTF(Stats, "registering %s\n", _name);
-}
-
-void
regStat(void *stat, StatData *data)
{
if (map().find(stat) != map().end())
diff --git a/src/base/stats/statdb.hh b/src/base/stats/statdb.hh
index 8c56e031e..a5b9be7eb 100644
--- a/src/base/stats/statdb.hh
+++ b/src/base/stats/statdb.hh
@@ -40,31 +40,25 @@ class Python;
namespace Stats {
-class MainBin;
class StatData;
namespace Database {
typedef std::map<void *, StatData *> stat_map_t;
typedef std::list<StatData *> stat_list_t;
-typedef std::list<MainBin *> bin_list_t;
// We wrap the database in a struct to make sure it is built in time.
struct TheDatabase
{
stat_map_t map;
stat_list_t stats;
- bin_list_t bins;
-
};
TheDatabase &db();
inline stat_map_t &map() { return db().map; }
inline stat_list_t &stats() { return db().stats; }
-inline bin_list_t &bins() { return db().bins; }
StatData *find(void *stat);
-void regBin(MainBin *bin, const std::string &name);
void regStat(void *stat, StatData *data);
void regPrint(void *stat);
diff --git a/src/base/stats/text.cc b/src/base/stats/text.cc
index 8d2144665..c4448efc9 100644
--- a/src/base/stats/text.cc
+++ b/src/base/stats/text.cc
@@ -129,23 +129,9 @@ Text::output()
using namespace Database;
ccprintf(*stream, "\n---------- Begin Simulation Statistics ----------\n");
- if (bins().empty() || bins().size() == 1) {
- stat_list_t::const_iterator i, end = stats().end();
- for (i = stats().begin(); i != end; ++i)
- (*i)->visit(*this);
- } else {
- ccprintf(*stream, "PRINTING BINNED STATS\n");
- bin_list_t::iterator i, end = bins().end();
- for (i = bins().begin(); i != end; ++i) {
- MainBin *bin = *i;
- bin->activate();
- ccprintf(*stream,"---%s Bin------------\n", bin->name());
- stat_list_t::const_iterator i, end = stats().end();
- for (i = stats().begin(); i != end; ++i)
- (*i)->visit(*this);
- ccprintf(*stream, "---------------------------------\n");
- }
- }
+ stat_list_t::const_iterator i, end = stats().end();
+ for (i = stats().begin(); i != end; ++i)
+ (*i)->visit(*this);
ccprintf(*stream, "\n---------- End Simulation Statistics ----------\n");
stream->flush();
}
diff --git a/src/base/stats/text.hh b/src/base/stats/text.hh
index de27abe1b..b3faf5ad5 100644
--- a/src/base/stats/text.hh
+++ b/src/base/stats/text.hh
@@ -46,7 +46,6 @@ class Text : public Output
protected:
bool noOutput(const StatData &data);
- void binout();
public:
bool compat;