#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"
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')
+++ /dev/null
-/*
- * 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 */ }
+++ /dev/null
-/*
- * 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__
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
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;
}
MySql::MySql()
- : run(new MySqlRun), newdata(run), newevent(run)
+ : run(new MySqlRun), newdata(run)
{}
MySql::~MySql()
newdata.flush();
}
-void
-MySql::event(const std::string &event)
-{
- newevent.insert(event);
-}
-
void
MySql::output(const ScalarInfo &info)
{
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:
SetupStat stat;
InsertData newdata;
- InsertEvent newevent;
std::list<FormulaInfo *> formulas;
bool configured;
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);
inline void operator()() { output(); }
virtual void output() = 0;
virtual bool valid() const = 0;
- virtual void event(const std::string &event) = 0;
};
/* namespace Stats */ }
// 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);
}
}
-*/
-/*
- if (!dcacheInterface && (memReq->isUncacheable()))
- recordEvent("Uncached Read");
*/
return LSQ.read(req, data, load_idx);
}
if (res && (fault == NoFault))
*res = memReq->result;
*/
-/*
- if (!dcacheInterface && (memReq->isUncacheable()))
- recordEvent("Uncached Write");
-*/
return LSQ.write(req, data, store_idx);
}
DPRINTF(IBE, "Dcache hit!\n");
}
}
-/*
- if (!dcacheInterface && (memReq->isUncacheable()))
- recordEvent("Uncached Read");
-*/
return fault;
}
if (res && (fault == NoFault))
*res = memReq->result;
-/*
- if (!dcacheInterface && (memReq->isUncacheable()))
- recordEvent("Uncached Write");
-*/
return fault;
}
}
}
-/*
- if (!dcacheInterface && (req->isUncacheable()))
- recordEvent("Uncached Read");
-*/
return NoFault;
}
if (res && (fault == NoFault))
*res = req->result;
*/
-/*
- if (!dcacheInterface && (req->isUncacheable()))
- recordEvent("Uncached Write");
-*/
return NoFault;
}
#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"
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());
}
#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"
}
#endif
-void
-SimObject::recordEvent(const std::string &stat)
-{
- Stats::recordEvent(stat);
-}
-
unsigned int
SimObject::drain(Event *drain_event)
{
* 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__