From 3fb3616be4bc68c15aa67df0b93d6b0f790acd16 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Wed, 21 Feb 2007 10:15:17 -0800 Subject: Fix majory brokenness in my previous MySQL commit, basically this is just a shuffling around of code and fixes to make stuff commit properly --HG-- extra : convert_revision : a057f7fe4962cfc6200781ff66d2c26bf9c6eb8c --- src/base/stats/mysql.hh | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'src/base/stats/mysql.hh') diff --git a/src/base/stats/mysql.hh b/src/base/stats/mysql.hh index a43c74ecc..52f93ac61 100644 --- a/src/base/stats/mysql.hh +++ b/src/base/stats/mysql.hh @@ -62,7 +62,7 @@ struct SetupStat uint16_t size; void init(); - unsigned setup(); + unsigned setup(MySqlRun *run); }; class InsertData @@ -84,13 +84,34 @@ class InsertData int16_t y; public: - InsertData(); + InsertData(MySqlRun *_run); ~InsertData(); void flush(); void insert(); }; +class InsertEvent +{ + private: + char *query; + int size; + bool first; + static const int maxsize = 1024*1024; + + typedef std::map event_map_t; + event_map_t events; + + MySqlRun *run; + + public: + InsertEvent(MySqlRun *_run); + ~InsertEvent(); + + void flush(); + void insert(const std::string &stat); +}; + class MySql : public Output { protected: @@ -99,6 +120,7 @@ class MySql : public Output SetupStat stat; InsertData newdata; + InsertEvent newevent; std::list formulas; bool configured; @@ -120,7 +142,7 @@ class MySql : public Output } public: - MySql(MySqlRun &_run){} + MySql(); ~MySql(); void connect(const std::string &host, const std::string &user, @@ -142,6 +164,9 @@ class MySql : public Output virtual bool valid() const; virtual void output(); + // Implement Event Output + virtual void event(const std::string &event); + protected: // Output helper void output(const DistDataData &data); -- cgit v1.2.3