stats: get rid of the never-really-used event stuff

This commit is contained in:
Nathan Binkert 2010-06-14 23:24:46 -07:00
parent 420402c0a3
commit 54d813adca
14 changed files with 1 additions and 301 deletions

View file

@ -36,7 +36,6 @@
#include "arch/alpha/tlb.hh"
#include "base/cp_annotate.hh"
#include "base/debug.hh"
#include "base/stats/events.hh"
#include "config/full_system.hh"
#include "cpu/base.hh"
#include "cpu/simple_thread.hh"

View file

@ -75,7 +75,6 @@ Source('loader/object_file.cc')
Source('loader/raw_object.cc')
Source('loader/symtab.cc')
Source('stats/events.cc')
Source('stats/output.cc')
Source('stats/text.cc')
Source('stats/visit.cc')

View file

@ -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 <vector>
#include "base/stats/events.hh"
#include "base/stats/output.hh"
#include "base/types.hh"
using namespace std;
namespace Stats {
Tick EventStart = MaxTick;
extern list<Output *> OutputList;
#if USE_MYSQL
void
__event(const string &event)
{
list<Output *>::iterator i = OutputList.begin();
list<Output *>::iterator end = OutputList.end();
for (; i != end; ++i) {
Output *output = *i;
if (!output->valid())
continue;
output->event(event);
}
}
#endif
/* namespace Stats */ }

View file

@ -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 <string>
#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__

View file

@ -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)
{

View file

@ -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<std::string, uint32_t> 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<FormulaInfo *> 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);

View file

@ -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 */ }

View file

@ -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);

View file

@ -491,10 +491,6 @@ BackEnd<Impl>::read(RequestPtr req, T &data, int load_idx)
}
}
*/
/*
if (!dcacheInterface && (memReq->isUncacheable()))
recordEvent("Uncached Read");
*/
return LSQ.read(req, data, load_idx);
}
@ -533,10 +529,6 @@ BackEnd<Impl>::write(RequestPtr req, T &data, int store_idx)
if (res && (fault == NoFault))
*res = memReq->result;
*/
/*
if (!dcacheInterface && (memReq->isUncacheable()))
recordEvent("Uncached Write");
*/
return LSQ.write(req, data, store_idx);
}

View file

@ -229,10 +229,6 @@ InorderBackEnd<Impl>::read(Addr addr, T &data, unsigned flags)
DPRINTF(IBE, "Dcache hit!\n");
}
}
/*
if (!dcacheInterface && (memReq->isUncacheable()))
recordEvent("Uncached Read");
*/
return fault;
}
@ -269,10 +265,6 @@ InorderBackEnd<Impl>::write(T data, Addr addr, unsigned flags, uint64_t *res)
if (res && (fault == NoFault))
*res = memReq->result;
/*
if (!dcacheInterface && (memReq->isUncacheable()))
recordEvent("Uncached Write");
*/
return fault;
}
@ -313,10 +305,6 @@ InorderBackEnd<Impl>::read(MemReqPtr &req, T &data, int load_idx)
}
}
/*
if (!dcacheInterface && (req->isUncacheable()))
recordEvent("Uncached Read");
*/
return NoFault;
}
@ -390,10 +378,6 @@ InorderBackEnd<Impl>::write(MemReqPtr &req, T &data, int store_idx)
if (res && (fault == NoFault))
*res = req->result;
*/
/*
if (!dcacheInterface && (req->isUncacheable()))
recordEvent("Uncached Write");
*/
return NoFault;
}

View file

@ -49,7 +49,6 @@
#include "base/misc.hh"
#include "base/pollevent.hh"
#include "base/range.hh"
#include "base/stats/events.hh"
#include "base/trace.hh"
#include "base/types.hh"
#include "config/the_isa.hh"

View file

@ -46,7 +46,6 @@ void FaultBase::invoke(ThreadContext * tc)
void FaultBase::invoke(ThreadContext * tc)
{
DPRINTF(Fault, "Fault %s at PC: %#x\n", name(), tc->readPC());
tc->getCpuPtr()->recordEvent(csprintf("Fault %s", name()));
assert(!tc->misspeculating());
}

View file

@ -35,7 +35,6 @@
#include "base/inifile.hh"
#include "base/match.hh"
#include "base/misc.hh"
#include "base/stats/events.hh"
#include "base/trace.hh"
#include "base/types.hh"
#include "sim/sim_object.hh"
@ -220,12 +219,6 @@ debugObjectBreak(const char *objs)
}
#endif
void
SimObject::recordEvent(const std::string &stat)
{
Stats::recordEvent(stat);
}
unsigned int
SimObject::drain(Event *drain_event)
{

View file

@ -136,9 +136,6 @@ class SimObject
* char* rather than std::string to make it callable from gdb.
*/
static SimObject *find(const char *name);
public:
void recordEvent(const std::string &stat);
};
#endif // __SIM_OBJECT_HH__