From 54d813adcaf6d5eda4040c20bae1706b0a78324b Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Mon, 14 Jun 2010 23:24:46 -0700 Subject: stats: get rid of the never-really-used event stuff --- src/base/stats/events.cc | 62 -------------------------- src/base/stats/events.hh | 62 -------------------------- src/base/stats/mysql.cc | 111 +---------------------------------------------- src/base/stats/mysql.hh | 25 ----------- src/base/stats/output.hh | 1 - src/base/stats/text.hh | 3 -- 6 files changed, 1 insertion(+), 263 deletions(-) delete mode 100644 src/base/stats/events.cc delete mode 100644 src/base/stats/events.hh (limited to 'src/base/stats') diff --git a/src/base/stats/events.cc b/src/base/stats/events.cc deleted file mode 100644 index 29117b1e2..000000000 --- a/src/base/stats/events.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Regents of The University of Michigan - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Nathan Binkert - */ - -#include - -#include "base/stats/events.hh" -#include "base/stats/output.hh" -#include "base/types.hh" - -using namespace std; - -namespace Stats { - -Tick EventStart = MaxTick; - -extern list OutputList; - -#if USE_MYSQL -void -__event(const string &event) -{ - list::iterator i = OutputList.begin(); - list::iterator end = OutputList.end(); - for (; i != end; ++i) { - Output *output = *i; - if (!output->valid()) - continue; - - output->event(event); - } -} - -#endif - -/* namespace Stats */ } diff --git a/src/base/stats/events.hh b/src/base/stats/events.hh deleted file mode 100644 index 8ba9cece5..000000000 --- a/src/base/stats/events.hh +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Regents of The University of Michigan - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Nathan Binkert - */ - -#ifndef __BASE_STATS_EVENTS_HH__ -#define __BASE_STATS_EVENTS_HH__ - -#include - -#include "base/trace.hh" -#include "config/use_mysql.hh" - -namespace Stats { - -extern Tick EventStart; - -#if USE_MYSQL -void __event(const std::string &stat); -#else -inline void __event(const std::string &stat) {} -#endif - -inline void -recordEvent(const std::string &stat) -{ - if (EventStart > curTick) - return; - - DPRINTF(StatEvents, "Statistics Event: %s\n", stat); - - __event(stat); -} - -/* namespace Stats */ } - -#endif // __BASE_STATS_EVENTS_HH__ diff --git a/src/base/stats/mysql.cc b/src/base/stats/mysql.cc index cfac9a226..91ab6dc15 100644 --- a/src/base/stats/mysql.cc +++ b/src/base/stats/mysql.cc @@ -150,22 +150,6 @@ MySqlRun::cleanup() 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" - "WHERE rn_id IS NULL"); - - if (mysql.commit()) - panic("could not commit transaction\n%s\n", mysql.error); - - mysql.query("DELETE event_names" - "FROM event_names" - "LEFT JOIN events ON en_id=ev_event" - "WHERE ev_event IS NULL"); - - if (mysql.commit()) - panic("could not commit transaction\n%s\n", mysql.error); } void @@ -347,93 +331,6 @@ InsertData::insert() data); } -InsertEvent::InsertEvent(MySqlRun *_run) - : run(_run) -{ - query = new char[maxsize + 1]; - size = 0; - first = true; - flush(); -} - -InsertEvent::~InsertEvent() -{ - flush(); -} - -void -InsertEvent::insert(const string &stat) -{ - MySQL::Connection &mysql = run->conn(); - assert(mysql.connected()); - - event_map_t::iterator i = events.find(stat); - uint32_t event; - if (i == events.end()) { - mysql.query( - csprintf("SELECT en_id " - "from event_names " - "where en_name=\"%s\"", - stat)); - - MySQL::Result result = mysql.store_result(); - if (!result) - panic("could not get a run\n%s\n", mysql.error); - - assert(result.num_fields() == 1); - MySQL::Row row = result.fetch_row(); - if (row) { - if (!to_number(row[0], event)) - panic("invalid event id: %s\n", row[0]); - } else { - mysql.query( - csprintf("INSERT INTO " - "event_names(en_name)" - "values(\"%s\")", - stat)); - - if (mysql.error) - panic("could not get a run\n%s\n", mysql.error); - - event = mysql.insert_id(); - } - } else { - event = (*i).second; - } - - if (size + 1024 > maxsize) - flush(); - - if (!first) { - query[size++] = ','; - query[size] = '\0'; - } - - first = false; - - size += sprintf(query + size, "(%u,%u,%llu)", - event, run->run(), (unsigned long long)curTick); -} - -void -InsertEvent::flush() -{ - static const char query_header[] = "INSERT INTO " - "events(ev_event, ev_run, ev_tick)" - "values"; - - MySQL::Connection &mysql = run->conn(); - assert(mysql.connected()); - - if (size) - mysql.query(query); - - query[0] = '\0'; - size = sizeof(query_header); - first = true; - memcpy(query, query_header, size); -} - struct InsertSubData { uint16_t stat; @@ -465,7 +362,7 @@ InsertSubData::setup(MySqlRun *run) } MySql::MySql() - : run(new MySqlRun), newdata(run), newevent(run) + : run(new MySqlRun), newdata(run) {} MySql::~MySql() @@ -729,12 +626,6 @@ MySql::output() newdata.flush(); } -void -MySql::event(const std::string &event) -{ - newevent.insert(event); -} - void MySql::output(const ScalarInfo &info) { diff --git a/src/base/stats/mysql.hh b/src/base/stats/mysql.hh index 45fda2982..687f030f2 100644 --- a/src/base/stats/mysql.hh +++ b/src/base/stats/mysql.hh @@ -92,27 +92,6 @@ class InsertData void insert(); }; -class InsertEvent -{ - private: - char *query; - size_type size; - bool first; - static const size_type 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: @@ -121,7 +100,6 @@ class MySql : public Output SetupStat stat; InsertData newdata; - InsertEvent newevent; std::list formulas; bool configured; @@ -167,9 +145,6 @@ 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 ScalarInfo &info); diff --git a/src/base/stats/output.hh b/src/base/stats/output.hh index c7ffcaade..4fe93791f 100644 --- a/src/base/stats/output.hh +++ b/src/base/stats/output.hh @@ -42,7 +42,6 @@ struct Output : public Visit inline void operator()() { output(); } virtual void output() = 0; virtual bool valid() const = 0; - virtual void event(const std::string &event) = 0; }; /* namespace Stats */ } diff --git a/src/base/stats/text.hh b/src/base/stats/text.hh index 04b914ae9..0cb66ded8 100644 --- a/src/base/stats/text.hh +++ b/src/base/stats/text.hh @@ -71,9 +71,6 @@ class Text : public Output // Implement Output virtual bool valid() const; virtual void output(); - - // Implement Event Output - virtual void event(const std::string &event) {} }; bool initText(const std::string &filename, bool desc); -- cgit v1.2.3