diff options
author | Ali Saidi <saidi@eecs.umich.edu> | 2004-05-31 18:58:54 -0400 |
---|---|---|
committer | Ali Saidi <saidi@eecs.umich.edu> | 2004-05-31 18:58:54 -0400 |
commit | 93983de0cfa06e58f1d448782269ebd33341ae83 (patch) | |
tree | 16d50228d138b5334f8cd1d3feffcfdd2c3adacf /base/stats/mysql.hh | |
parent | 9d0aa1399157bd90436409a7596377b4591a2d4a (diff) | |
parent | 6964ecd1cf14f294a300e91bc5b65042d03952d4 (diff) | |
download | gem5-93983de0cfa06e58f1d448782269ebd33341ae83.tar.xz |
Merged head into linux tree
base/stats/mysql.hh:
Rename of Statsistics namespace to stats... merge from head
--HG--
extra : convert_revision : a5a7f6268b35e75fba1b1800a74fcd6dbd09d974
Diffstat (limited to 'base/stats/mysql.hh')
-rw-r--r-- | base/stats/mysql.hh | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/base/stats/mysql.hh b/base/stats/mysql.hh index dd88f5724..4aa8858b1 100644 --- a/base/stats/mysql.hh +++ b/base/stats/mysql.hh @@ -29,6 +29,7 @@ #ifndef __BASE_STATS_MYSQL_HH__ #define __BASE_STATS_MYSQL_HH__ +#include <map> #include <string> #include "base/stats/output.hh" @@ -37,7 +38,9 @@ namespace MySQL { class Connection; } namespace Stats { class DistDataData; -class MySqlData; +class MySqlRun; +bool MySqlConnected(); +extern MySqlRun MySqlDB; struct SetupStat { @@ -58,7 +61,7 @@ struct SetupStat uint16_t size; void init(); - unsigned operator()(MySqlData *data); + unsigned setup(); }; class InsertData @@ -70,14 +73,13 @@ class InsertData static const int maxsize = 1024*1024; public: - MySQL::Connection *mysql; + MySqlRun *run; public: uint64_t sample; double data; uint16_t stat; uint16_t bin; - uint16_t run; int16_t x; int16_t y; @@ -92,25 +94,28 @@ class InsertData class MySql : public Output { protected: - std::list<FormulaData *> formulas; - MySqlData *mysql; - bool configured; - uint16_t run_id; - SetupStat stat; InsertData newdata; + std::list<FormulaData *> formulas; + bool configured; - void insert(int sim_id, int db_id); - int find(int sim_id); - + protected: + std::map<int, int> idmap; + + void insert(int sim_id, int db_id) + { + using namespace std; + idmap.insert(make_pair(sim_id, db_id)); + } + + int find(int sim_id) + { + using namespace std; + map<int,int>::const_iterator i = idmap.find(sim_id); + assert(i != idmap.end()); + return (*i).second; + } public: - MySql(); - ~MySql(); - - void connect(const std::string &host, const std::string &user, - const std::string &passwd, const std::string &db, - const std::string &name, const std::string &project); - // Implement Visit virtual void visit(const ScalarData &data); virtual void visit(const VectorData &data); |