Remove all binning stuff

--HG--
extra : convert_revision : 6da2b3b0b6c2824f2064d42670fd8383edb7c718
This commit is contained in:
Nathan Binkert 2006-06-10 13:08:43 -04:00
parent f1fab2a446
commit 7af93dbdf6
29 changed files with 672 additions and 1268 deletions

View file

@ -253,7 +253,6 @@ full_system_sources = Split('''
dev/uart.cc
dev/uart8250.cc
kern/kernel_binning.cc
kern/kernel_stats.cc
kern/system_events.cc
kern/linux/events.cc

View file

@ -116,10 +116,6 @@ BEGIN_DECLARE_SIM_OBJECT_PARAMS(FreebsdAlphaSystem)
Param<uint64_t> system_type;
Param<uint64_t> system_rev;
Param<bool> bin;
VectorParam<string> binned_fns;
Param<bool> bin_int;
END_DECLARE_SIM_OBJECT_PARAMS(FreebsdAlphaSystem)
BEGIN_INIT_SIM_OBJECT_PARAMS(FreebsdAlphaSystem)
@ -135,10 +131,7 @@ BEGIN_INIT_SIM_OBJECT_PARAMS(FreebsdAlphaSystem)
INIT_PARAM_DFLT(readfile, "file to read startup script from", ""),
INIT_PARAM_DFLT(init_param, "numerical value to pass into simulator", 0),
INIT_PARAM_DFLT(system_type, "Type of system we are emulating", 34),
INIT_PARAM_DFLT(system_rev, "Revision of system we are emulating", 1<<10),
INIT_PARAM_DFLT(bin, "is this system to be binned", false),
INIT_PARAM(binned_fns, "functions to be broken down and binned"),
INIT_PARAM_DFLT(bin_int, "is interrupt code binned seperately?", true)
INIT_PARAM_DFLT(system_rev, "Revision of system we are emulating", 1<<10)
END_INIT_SIM_OBJECT_PARAMS(FreebsdAlphaSystem)
@ -157,9 +150,6 @@ CREATE_SIM_OBJECT(FreebsdAlphaSystem)
p->readfile = readfile;
p->system_type = system_type;
p->system_rev = system_rev;
p->bin = bin;
p->binned_fns = binned_fns;
p->bin_int = bin_int;
return new FreebsdAlphaSystem(p);
}

View file

@ -148,24 +148,6 @@ LinuxAlphaSystem::LinuxAlphaSystem(Params *p)
} else {
printThreadEvent = NULL;
}
if (params()->bin_int) {
intStartEvent = addPalFuncEvent<InterruptStartEvent>("sys_int_21");
if (!intStartEvent)
panic("could not find symbol: sys_int_21\n");
intEndEvent = addPalFuncEvent<InterruptEndEvent>("rti_to_kern");
if (!intEndEvent)
panic("could not find symbol: rti_to_kern\n");
intEndEvent2 = addPalFuncEvent<InterruptEndEvent>("rti_to_user");
if (!intEndEvent2)
panic("could not find symbol: rti_to_user\n");
intEndEvent3 = addKernelFuncEvent<InterruptEndEvent>("do_softirq");
if (!intEndEvent3)
panic("could not find symbol: do_softirq\n");
}
}
LinuxAlphaSystem::~LinuxAlphaSystem()
@ -238,10 +220,6 @@ BEGIN_DECLARE_SIM_OBJECT_PARAMS(LinuxAlphaSystem)
Param<uint64_t> system_type;
Param<uint64_t> system_rev;
Param<bool> bin;
VectorParam<string> binned_fns;
Param<bool> bin_int;
END_DECLARE_SIM_OBJECT_PARAMS(LinuxAlphaSystem)
BEGIN_INIT_SIM_OBJECT_PARAMS(LinuxAlphaSystem)
@ -257,10 +235,7 @@ BEGIN_INIT_SIM_OBJECT_PARAMS(LinuxAlphaSystem)
INIT_PARAM_DFLT(readfile, "file to read startup script from", ""),
INIT_PARAM_DFLT(init_param, "numerical value to pass into simulator", 0),
INIT_PARAM_DFLT(system_type, "Type of system we are emulating", 34),
INIT_PARAM_DFLT(system_rev, "Revision of system we are emulating", 1<<10),
INIT_PARAM_DFLT(bin, "is this system to be binned", false),
INIT_PARAM(binned_fns, "functions to be broken down and binned"),
INIT_PARAM_DFLT(bin_int, "is interrupt code binned seperately?", true)
INIT_PARAM_DFLT(system_rev, "Revision of system we are emulating", 1<<10)
END_INIT_SIM_OBJECT_PARAMS(LinuxAlphaSystem)
@ -279,9 +254,6 @@ CREATE_SIM_OBJECT(LinuxAlphaSystem)
p->readfile = readfile;
p->system_type = system_type;
p->system_rev = system_rev;
p->bin = bin;
p->binned_fns = binned_fns;
p->bin_int = bin_int;
return new LinuxAlphaSystem(p);
}

View file

@ -42,7 +42,7 @@ using namespace Linux;
using namespace std;
/**
* This class contains linux specific system code (Loading, Events, Binning).
* This class contains linux specific system code (Loading, Events).
* It points to objects that are the system binaries to load and patches them
* appropriately to work in simulator.
*/
@ -121,18 +121,6 @@ class LinuxAlphaSystem : public AlphaSystem
*/
PrintThreadInfo *printThreadEvent;
/**
* Event to bin Interrupts seperately from kernel code
*/
InterruptStartEvent *intStartEvent;
/**
* Event to bin Interrupts seperately from kernel code
*/
InterruptEndEvent *intEndEvent;
InterruptEndEvent *intEndEvent2;
InterruptEndEvent *intEndEvent3;
/** Grab the PCBB of the idle process when it starts */
IdleStartEvent *idleStartEvent;

View file

@ -247,10 +247,6 @@ BEGIN_DECLARE_SIM_OBJECT_PARAMS(AlphaSystem)
Param<uint64_t> system_type;
Param<uint64_t> system_rev;
Param<bool> bin;
VectorParam<std::string> binned_fns;
Param<bool> bin_int;
END_DECLARE_SIM_OBJECT_PARAMS(AlphaSystem)
BEGIN_INIT_SIM_OBJECT_PARAMS(AlphaSystem)
@ -266,10 +262,7 @@ BEGIN_INIT_SIM_OBJECT_PARAMS(AlphaSystem)
INIT_PARAM_DFLT(readfile, "file to read startup script from", ""),
INIT_PARAM_DFLT(init_param, "numerical value to pass into simulator", 0),
INIT_PARAM_DFLT(system_type, "Type of system we are emulating", 34),
INIT_PARAM_DFLT(system_rev, "Revision of system we are emulating", 1<<10),
INIT_PARAM_DFLT(bin, "is this system to be binned", false),
INIT_PARAM(binned_fns, "functions to be broken down and binned"),
INIT_PARAM_DFLT(bin_int, "is interrupt code binned seperately?", true)
INIT_PARAM_DFLT(system_rev, "Revision of system we are emulating", 1<<10)
END_INIT_SIM_OBJECT_PARAMS(AlphaSystem)
@ -288,9 +281,6 @@ CREATE_SIM_OBJECT(AlphaSystem)
p->readfile = readfile;
p->system_type = system_type;
p->system_rev = system_rev;
p->bin = bin;
p->binned_fns = binned_fns;
p->bin_int = bin_int;
return new AlphaSystem(p);
}

View file

@ -110,9 +110,6 @@ BEGIN_DECLARE_SIM_OBJECT_PARAMS(Tru64AlphaSystem)
Param<uint64_t> system_type;
Param<uint64_t> system_rev;
Param<bool> bin;
VectorParam<string> binned_fns;
END_DECLARE_SIM_OBJECT_PARAMS(Tru64AlphaSystem)
BEGIN_INIT_SIM_OBJECT_PARAMS(Tru64AlphaSystem)
@ -128,9 +125,7 @@ BEGIN_INIT_SIM_OBJECT_PARAMS(Tru64AlphaSystem)
INIT_PARAM_DFLT(readfile, "file to read startup script from", ""),
INIT_PARAM_DFLT(init_param, "numerical value to pass into simulator", 0),
INIT_PARAM_DFLT(system_type, "Type of system we are emulating", 12),
INIT_PARAM_DFLT(system_rev, "Revision of system we are emulating", 2<<1),
INIT_PARAM_DFLT(bin, "is this system to be binned", false),
INIT_PARAM(binned_fns, "functions to be broken down and binned")
INIT_PARAM_DFLT(system_rev, "Revision of system we are emulating", 2<<1)
END_INIT_SIM_OBJECT_PARAMS(Tru64AlphaSystem)
@ -149,9 +144,6 @@ CREATE_SIM_OBJECT(Tru64AlphaSystem)
p->readfile = readfile;
p->system_type = system_type;
p->system_rev = system_rev;
p->bin = bin;
p->binned_fns = binned_fns;
p->bin_int = false;
return new Tru64AlphaSystem(p);
}

View file

@ -42,7 +42,6 @@
#include "base/time.hh"
#include "base/trace.hh"
#include "base/stats/statdb.hh"
#include "config/stats_binning.hh"
using namespace std;
@ -173,12 +172,6 @@ FormulaBase::size() const
return root->size();
}
bool
FormulaBase::binned() const
{
return root && root->binned();
}
void
FormulaBase::reset()
{
@ -237,33 +230,6 @@ Formula::operator+=(Temp r)
return *this;
}
MainBin::MainBin(const string &name)
: _name(name), mem(NULL), memsize(-1)
{
Database::regBin(this, name);
}
MainBin::~MainBin()
{
if (mem)
delete [] mem;
}
char *
MainBin::memory(off_t off)
{
if (memsize == -1)
memsize = ceilPow2((size_t) offset());
if (!mem) {
mem = new char[memsize];
memset(mem, 0, memsize);
}
assert(offset() <= size());
return mem + off;
}
void
check()
{
@ -286,13 +252,6 @@ check()
Database::stats().sort(StatData::less);
#if STATS_BINNING
if (MainBin::curBin() == NULL) {
static MainBin mainBin("main bin");
mainBin.activate();
}
#endif
if (i == end)
return;
@ -312,39 +271,14 @@ CallbackQueue resetQueue;
void
reset()
{
// reset non-binned stats
Database::stat_list_t::iterator i = Database::stats().begin();
Database::stat_list_t::iterator end = Database::stats().end();
while (i != end) {
StatData *data = *i;
if (!data->binned())
data->reset();
data->reset();
++i;
}
// save the bin so we can go back to where we were
MainBin *orig = MainBin::curBin();
// reset binned stats
Database::bin_list_t::iterator bi = Database::bins().begin();
Database::bin_list_t::iterator be = Database::bins().end();
while (bi != be) {
MainBin *bin = *bi;
bin->activate();
i = Database::stats().begin();
while (i != end) {
StatData *data = *i;
if (data->binned())
data->reset();
++i;
}
++bi;
}
// restore bin
MainBin::curBin() = orig;
resetQueue.process();
}

File diff suppressed because it is too large Load diff

View file

@ -156,14 +156,6 @@ MySqlRun::cleanup()
if (mysql.commit())
panic("could not commit transaction\n%s\n", mysql.error);
mysql.query("DELETE bins "
"FROM bins "
"LEFT JOIN data ON bn_id=dt_bin "
"WHERE dt_bin IS NULL");
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"
@ -307,52 +299,6 @@ SetupStat::setup()
return statid;
}
unsigned
SetupBin(const string &bin)
{
static map<string, int> binmap;
using namespace MySQL;
map<string,int>::const_iterator i = binmap.find(bin);
if (i != binmap.end())
return (*i).second;
Connection &mysql = MySqlDB.conn();
assert(mysql.connected());
uint16_t bin_id;
stringstream select;
stringstream insert;
ccprintf(select, "SELECT bn_id FROM bins WHERE bn_name=\"%s\"", bin);
mysql.query(select);
MySQL::Result result = mysql.store_result();
if (result) {
assert(result.num_fields() == 1);
MySQL::Row row = result.fetch_row();
if (row) {
to_number(row[0], bin_id);
goto exit;
}
}
ccprintf(insert, "INSERT INTO bins(bn_name) values(\"%s\")", bin);
mysql.query(insert);
if (mysql.error)
panic("could not get a bin\n%s\n", mysql.error);
bin_id = mysql.insert_id();
if (mysql.commit())
panic("could not commit transaction\n%s\n", mysql.error);
binmap.insert(make_pair(bin, bin_id));
exit:
return bin_id;
}
InsertData::InsertData()
{
query = new char[maxsize + 1];
@ -382,7 +328,7 @@ InsertData::flush()
size = 0;
first = true;
strcpy(query, "INSERT INTO "
"data(dt_stat,dt_x,dt_y,dt_run,dt_tick,dt_bin,dt_data) "
"data(dt_stat,dt_x,dt_y,dt_run,dt_tick,dt_data) "
"values");
size = strlen(query);
}
@ -400,9 +346,9 @@ InsertData::insert()
first = false;
size += sprintf(query + size, "(%u,%d,%d,%u,%llu,%u,\"%f\")",
size += sprintf(query + size, "(%u,%d,%d,%u,%llu,\"%f\")",
stat, x, y, MySqlDB.run(), (unsigned long long)tick,
bin, data);
data);
}
struct InsertSubData
@ -654,29 +600,6 @@ MySql::configure(const FormulaData &data)
InsertFormula(find(data.id), data.str());
}
void
MySql::output(MainBin *bin)
{
MySQL::Connection &mysql = MySqlDB.conn();
if (bin) {
bin->activate();
newdata.bin = SetupBin(bin->name());
} else {
newdata.bin = 0;
}
Database::stat_list_t::const_iterator i, end = Database::stats().end();
for (i = Database::stats().begin(); i != end; ++i) {
StatData *stat = *i;
if (bin && stat->binned() || !bin && !stat->binned()) {
stat->visit(*this);
if (mysql.commit())
panic("could not commit transaction\n%s\n", mysql.error);
}
}
}
bool
MySql::valid() const
{
@ -695,11 +618,14 @@ MySql::output()
// store sample #
newdata.tick = curTick;
output(NULL);
if (!bins().empty()) {
bin_list_t::iterator i, end = bins().end();
for (i = bins().begin(); i != end; ++i)
output(*i);
MySQL::Connection &mysql = MySqlDB.conn();
Database::stat_list_t::const_iterator i, end = Database::stats().end();
for (i = Database::stats().begin(); i != end; ++i) {
StatData *stat = *i;
stat->visit(*this);
if (mysql.commit())
panic("could not commit transaction\n%s\n", mysql.error);
}
newdata.flush();

View file

@ -37,7 +37,6 @@
namespace MySQL { class Connection; }
namespace Stats {
class MainBin;
class DistDataData;
class MySqlRun;
bool MySqlConnected();
@ -80,7 +79,6 @@ class InsertData
uint64_t tick;
double data;
uint16_t stat;
uint16_t bin;
int16_t x;
int16_t y;
@ -131,7 +129,6 @@ class MySql : public Output
protected:
// Output helper
void output(MainBin *bin);
void output(const DistDataData &data);
void output(const ScalarData &data);
void output(const VectorData &data);

View file

@ -29,7 +29,6 @@
#include "base/misc.hh"
#include "base/trace.hh"
#include "base/statistics.hh"
#include "base/stats/bin.hh"
#include "base/stats/statdb.hh"
using namespace std;
@ -48,17 +47,6 @@ find(void *stat)
return (*i).second;
}
void
regBin(MainBin *bin, const std::string &_name)
{
bin_list_t::iterator i, end = bins().end();
for (i = bins().begin(); i != end; ++i)
if ((*i)->name() == _name)
panic("re-registering bin %s", _name);
bins().push_back(bin);
DPRINTF(Stats, "registering %s\n", _name);
}
void
regStat(void *stat, StatData *data)
{

View file

@ -38,31 +38,25 @@ class Python;
namespace Stats {
class MainBin;
class StatData;
namespace Database {
typedef std::map<void *, StatData *> stat_map_t;
typedef std::list<StatData *> stat_list_t;
typedef std::list<MainBin *> bin_list_t;
// We wrap the database in a struct to make sure it is built in time.
struct TheDatabase
{
stat_map_t map;
stat_list_t stats;
bin_list_t bins;
};
TheDatabase &db();
inline stat_map_t &map() { return db().map; }
inline stat_list_t &stats() { return db().stats; }
inline bin_list_t &bins() { return db().bins; }
StatData *find(void *stat);
void regBin(MainBin *bin, const std::string &name);
void regStat(void *stat, StatData *data);
void regPrint(void *stat);

View file

@ -126,23 +126,9 @@ Text::output()
using namespace Database;
ccprintf(*stream, "\n---------- Begin Simulation Statistics ----------\n");
if (bins().empty() || bins().size() == 1) {
stat_list_t::const_iterator i, end = stats().end();
for (i = stats().begin(); i != end; ++i)
(*i)->visit(*this);
} else {
ccprintf(*stream, "PRINTING BINNED STATS\n");
bin_list_t::iterator i, end = bins().end();
for (i = bins().begin(); i != end; ++i) {
MainBin *bin = *i;
bin->activate();
ccprintf(*stream,"---%s Bin------------\n", bin->name());
stat_list_t::const_iterator i, end = stats().end();
for (i = stats().begin(); i != end; ++i)
(*i)->visit(*this);
ccprintf(*stream, "---------------------------------\n");
}
}
stat_list_t::const_iterator i, end = stats().end();
for (i = stats().begin(); i != end; ++i)
(*i)->visit(*this);
ccprintf(*stream, "\n---------- End Simulation Statistics ----------\n");
stream->flush();
}

View file

@ -44,7 +44,6 @@ class Text : public Output
protected:
bool noOutput(const StatData &data);
void binout();
public:
bool compat;

View file

@ -244,7 +244,6 @@ sticky_opts.AddOptions(
BoolOption('USE_SSE2',
'Compile for SSE2 (-msse2) to get IEEE FP on x86 hosts',
False),
BoolOption('STATS_BINNING', 'Bin statistics by CPU mode', have_mysql),
BoolOption('USE_MYSQL', 'Use MySQL for stats output', have_mysql),
BoolOption('USE_FENV', 'Use <fenv.h> IEEE mode control', have_fenv),
('CC', 'C compiler', os.environ.get('CC', env['CC'])),
@ -267,8 +266,7 @@ nonsticky_opts.AddOptions(
# These options get exported to #defines in config/*.hh (see m5/SConscript).
env.ExportOptions = ['FULL_SYSTEM', 'ALPHA_TLASER', 'USE_FENV', \
'USE_MYSQL', 'NO_FAST_ALLOC', 'SS_COMPATIBLE_FP', \
'STATS_BINNING']
'USE_MYSQL', 'NO_FAST_ALLOC', 'SS_COMPATIBLE_FP']
# Define a handy 'no-op' action
def no_action(target, source, env):

View file

@ -781,11 +781,6 @@ SimpleCPU::tick()
fault = curStaticInst->execute(this, traceData);
#if FULL_SYSTEM
if (system->kernelBinning->fnbin) {
assert(cpuXC->getKernelStats());
system->kernelBinning->execute(xcProxy, inst);
}
if (cpuXC->profile) {
bool usermode =
(cpuXC->readMiscReg(AlphaISA::IPR_DTB_CM) & 0x18) != 0;

View file

@ -42,13 +42,12 @@ using namespace Stats;
namespace Kernel {
const char *modestr[] = { "kernel", "user", "idle", "interrupt" };
const char *modestr[] = { "kernel", "user", "idle" };
Statistics::Statistics(System *system)
: idleProcess((Addr)-1), themode(kernel), lastModeTick(0),
iplLast(0), iplLastTick(0)
{
bin_int = system->params()->bin_int;
}
void
@ -183,7 +182,7 @@ Statistics::regStats(const string &_name)
void
Statistics::setIdleProcess(Addr idlepcbb, ExecContext *xc)
{
assert(themode == kernel || themode == interrupt);
assert(themode == kernel);
idleProcess = idlepcbb;
themode = idle;
changeMode(themode, xc);
@ -203,8 +202,6 @@ Statistics::changeMode(cpu_mode newmode, ExecContext *xc)
_modeGood[newmode]++;
_modeTicks[themode] += curTick - lastModeTick;
xc->getSystemPtr()->kernelBinning->changeMode(newmode);
lastModeTick = curTick;
themode = newmode;
}
@ -230,13 +227,9 @@ Statistics::mode(cpu_mode newmode, ExecContext *xc)
{
Addr pcbb = xc->readMiscReg(AlphaISA::IPR_PALtemp23);
if ((newmode == kernel || newmode == interrupt) &&
pcbb == idleProcess)
if (newmode == kernel && pcbb == idleProcess)
newmode = idle;
if (bin_int == false && newmode == interrupt)
newmode = kernel;
changeMode(newmode, xc);
}
@ -265,11 +258,6 @@ Statistics::callpal(int code, ExecContext *xc)
_syscall[cvtnum]++;
}
} break;
case PAL::swpctx:
if (xc->getSystemPtr()->kernelBinning)
xc->getSystemPtr()->kernelBinning->palSwapContext(xc);
break;
}
}

View file

@ -44,95 +44,17 @@ class System;
namespace Kernel {
enum cpu_mode { kernel, user, idle, interrupt, cpu_mode_num };
enum cpu_mode { kernel, user, idle, cpu_mode_num };
extern const char *modestr[];
class Binning
{
private:
std::string myname;
System *system;
private:
// lisa's binning stuff
struct fnCall
{
Stats::MainBin *myBin;
std::string name;
};
struct SWContext
{
Counter calls;
std::stack<fnCall *> callStack;
};
std::map<const std::string, Stats::MainBin *> fnBins;
std::map<const Addr, SWContext *> swCtxMap;
std::multimap<const std::string, std::string> callerMap;
void populateMap(std::string caller, std::string callee);
std::vector<FnEvent *> fnEvents;
Stats::Scalar<> fnCalls;
Stats::MainBin *getBin(const std::string &name);
bool findCaller(std::string, std::string) const;
SWContext *findContext(Addr pcb);
bool addContext(Addr pcb, SWContext *ctx)
{
return (swCtxMap.insert(std::make_pair(pcb, ctx))).second;
}
void remContext(Addr pcb)
{
swCtxMap.erase(pcb);
}
void dumpState() const;
SWContext *swctx;
std::vector<std::string> binned_fns;
private:
Stats::MainBin *modeBin[cpu_mode_num];
public:
const bool bin;
const bool fnbin;
cpu_mode themode;
void palSwapContext(ExecContext *xc);
void execute(ExecContext *xc, StaticInstPtr inst);
void call(ExecContext *xc, Stats::MainBin *myBin);
void changeMode(cpu_mode mode);
public:
Binning(System *sys);
virtual ~Binning();
const std::string name() const { return myname; }
void regStats(const std::string &name);
public:
virtual void serialize(std::ostream &os);
virtual void unserialize(Checkpoint *cp, const std::string &section);
};
class Statistics : public Serializable
{
private:
friend class Binning;
private:
std::string myname;
Addr idleProcess;
cpu_mode themode;
Tick lastModeTick;
bool bin_int;
void changeMode(cpu_mode newmode, ExecContext *xc);

View file

@ -48,22 +48,6 @@ SkipFuncEvent::process(ExecContext *xc)
}
}
FnEvent::FnEvent(PCEventQueue *q, const std::string &desc, Addr addr,
Stats::MainBin *bin)
: PCEvent(q, desc, addr), _name(desc), mybin(bin)
{
}
void
FnEvent::process(ExecContext *xc)
{
if (xc->misspeculating())
return;
xc->getSystemPtr()->kernelBinning->call(xc, mybin);
}
void
IdleStartEvent::process(ExecContext *xc)
{
@ -72,19 +56,3 @@ IdleStartEvent::process(ExecContext *xc)
xc->readMiscReg(AlphaISA::IPR_PALtemp23), xc);
remove();
}
void
InterruptStartEvent::process(ExecContext *xc)
{
if (xc->getKernelStats())
xc->getKernelStats()->mode(Kernel::interrupt, xc);
}
void
InterruptEndEvent::process(ExecContext *xc)
{
// We go back to kernel, if we are user, inside the rti
// pal code we will get switched to user because of the ICM write
if (xc->getKernelStats())
xc->getKernelStats()->mode(Kernel::kernel, xc);
}

View file

@ -42,19 +42,6 @@ class SkipFuncEvent : public PCEvent
virtual void process(ExecContext *xc);
};
class FnEvent : public PCEvent
{
public:
FnEvent(PCEventQueue *q, const std::string &desc, Addr addr,
Stats::MainBin *bin);
virtual void process(ExecContext *xc);
std::string myname() const { return _name; }
private:
std::string _name;
Stats::MainBin *mybin;
};
class IdleStartEvent : public PCEvent
{
public:
@ -64,23 +51,4 @@ class IdleStartEvent : public PCEvent
virtual void process(ExecContext *xc);
};
class InterruptStartEvent : public PCEvent
{
public:
InterruptStartEvent(PCEventQueue *q, const std::string &desc, Addr addr)
: PCEvent(q, desc, addr)
{}
virtual void process(ExecContext *xc);
};
class InterruptEndEvent : public PCEvent
{
public:
InterruptEndEvent(PCEventQueue *q, const std::string &desc, Addr addr)
: PCEvent(q, desc, addr)
{}
virtual void process(ExecContext *xc);
};
#endif // __SYSTEM_EVENTS_HH__

View file

@ -7,8 +7,6 @@ class System(SimObject):
memctrl = Param.MemoryController(Parent.any, "memory controller")
physmem = Param.PhysicalMemory(Parent.any, "phsyical memory")
init_param = Param.UInt64(0, "numerical value to pass into simulator")
bin = Param.Bool(False, "is this system binned")
binned_fns = VectorParam.String([], "functions broken down and binned")
kernel = Param.String("file that contains the kernel code")
readfile = Param.String("", "file to read startup script from")

View file

@ -65,16 +65,12 @@ System::System(Params *p)
// increment the number of running systms
numSystemsRunning++;
kernelBinning = new Kernel::Binning(this);
}
System::~System()
{
delete kernelSymtab;
delete kernel;
delete kernelBinning;
}
@ -140,17 +136,9 @@ System::replaceExecContext(ExecContext *xc, int id)
remoteGDB[id]->replaceExecContext(xc);
}
void
System::regStats()
{
kernelBinning->regStats(name() + ".kern");
}
void
System::serialize(ostream &os)
{
kernelBinning->serialize(os);
kernelSymtab->serialize("kernel_symtab", os);
}
@ -158,8 +146,6 @@ System::serialize(ostream &os)
void
System::unserialize(Checkpoint *cp, const string &section)
{
kernelBinning->unserialize(cp, section);
kernelSymtab->unserialize("kernel_symtab", cp, section);
}

View file

@ -46,7 +46,6 @@ class ObjectFile;
class PhysicalMemory;
class Platform;
class RemoteGDB;
namespace Kernel { class Binning; }
class System : public SimObject
{
@ -83,8 +82,6 @@ class System : public SimObject
/** Entry point in the kernel to start at */
Addr kernelEntry;
Kernel::Binning *kernelBinning;
protected:
/**
@ -131,9 +128,6 @@ class System : public SimObject
MemoryController *memctrl;
PhysicalMemory *physmem;
uint64_t init_param;
bool bin;
std::vector<std::string> binned_fns;
bool bin_int;
std::string kernel_path;
std::string readfile;
@ -172,7 +166,6 @@ class System : public SimObject
int registerExecContext(ExecContext *xc, int xcIndex);
void replaceExecContext(ExecContext *xc, int xcIndex);
void regStats();
void serialize(std::ostream &os);
void unserialize(Checkpoint *cp, const std::string &section);

View file

@ -48,10 +48,10 @@ Tick ticksPerSecond = ULL(2000000000);
Scalar<> s1;
Scalar<> s2;
Average<> s3;
Scalar<MainBin> s4;
Vector<MainBin> s5;
Distribution<MainBin> s6;
Vector<MainBin> s7;
Scalar<> s4;
Vector<> s5;
Distribution<> s6;
Vector<> s7;
AverageVector<> s8;
StandardDeviation<> s9;
AverageDeviation<> s10;
@ -70,9 +70,6 @@ Value f5;
Formula f6;
Formula f7;
MainBin bin1("bin1");
MainBin bin2("bin2");
ostream *outputStream = &cout;
double
@ -301,8 +298,6 @@ main(int argc, char *argv[])
check();
reset();
bin1.activate();
s16[1][0] = 1;
s16[0][1] = 3;
s16[0][0] = 2;
@ -493,7 +488,6 @@ main(int argc, char *argv[])
s6.sample(8);
s6.sample(9);
bin2.activate();
s6.sample(10);
s6.sample(10);
s6.sample(10);

View file

@ -135,10 +135,6 @@ class Database(object):
self.allRunIds = {}
self.allRunNames = {}
self.allBins = []
self.allBinIds = {}
self.allBinNames = {}
self.allFormulas = {}
self.stattop = {}
@ -147,7 +143,6 @@ class Database(object):
self.mode = 'sum';
self.runs = None
self.bins = None
self.ticks = None
self.method = 'sum'
self._method = type(self).sum
@ -218,11 +213,6 @@ class Database(object):
self.allRunIds[run.run] = run
self.allRunNames[run.name] = run
self.query('select * from bins')
for id,name in self.cursor.fetchall():
self.allBinIds[int(id)] = name
self.allBinNames[name] = int(id)
self.query('select sd_stat,sd_x,sd_y,sd_name,sd_descr from subdata')
for result in self.cursor.fetchall():
subdata = SubData(result)
@ -245,18 +235,6 @@ class Database(object):
self.allStatIds[stat.stat] = stat
self.allStatNames[stat.name] = stat
# Name: listbins
# Desc: Prints all bins matching regex argument, if no argument
# is given all bins are returned
def listBins(self, regex='.*'):
print '%-50s %-10s' % ('bin name', 'id')
print '-' * 61
names = self.allBinNames.keys()
names.sort()
for name in names:
id = self.allBinNames[name]
print '%-50s %-10d' % (name, id)
# Name: listruns
# Desc: Prints all runs matching a given user, if no argument
# is given all runs are returned
@ -360,39 +338,10 @@ class Database(object):
ret.append(stat)
return ret
def getBin(self, bins):
if type(bins) is not list:
bins = [ bins ]
ret = []
for bin in bins:
if type(bin) is int:
ret.append(bin)
elif type(bin) is str:
ret.append(self.allBinNames[bin])
else:
for name,id in self.allBinNames.items():
if bin.match(name):
ret.append(id)
return ret
def getNotBin(self, bin):
map = {}
for bin in getBin(bin):
map[bin] = 1
ret = []
for bin in self.allBinIds.keys():
if not map.has_key(bin):
ret.append(bin)
return ret
#########################################
# get the data
#
def inner(self, op, stat, bins, ticks, group=False):
def query(self, op, stat, ticks, group=False):
sql = 'select '
sql += 'dt_stat as stat, '
sql += 'dt_run as run, '
@ -414,10 +363,6 @@ class Database(object):
val = ' or '.join([ 'dt_run=%d' % r for r in self.runs ])
sql += ' and (%s)' % val
if bins != None and len(bins):
val = ' or '.join([ 'dt_bin=%d' % b for b in bins ])
sql += ' and (%s)' % val
if ticks != None and len(ticks):
val = ' or '.join([ 'dt_tick=%d' % s for s in ticks ])
sql += ' and (%s)' % val
@ -427,35 +372,21 @@ class Database(object):
sql += ',dt_tick'
return sql
def outer(self, op_out, op_in, stat, bins, ticks):
sql = self.inner(op_in, stat, bins, ticks, True)
sql = 'select stat,run,x,y,%s(data) from (%s) as tb ' % (op_out, sql)
sql += 'group by stat,run,x,y'
return sql
# Name: sum
# Desc: given a run, a stat and an array of samples and bins,
# sum all the bins and then get the standard deviation of the
# samples for non-binned runs. This will just return the average
# of samples, however a bin array still must be passed
def sum(self, stat, bins, ticks):
return self.inner('sum', stat, bins, ticks)
# Desc: given a run, a stat and an array of samples, total the samples
def sum(self, *args, **kwargs):
return self.query('sum', *args, **kwargs)
# Name: avg
# Desc: given a run, a stat and an array of samples and bins,
# sum all the bins and then average the samples for non-binned
# runs this will just return the average of samples, however
# a bin array still must be passed
def avg(self, stat, bins, ticks):
return self.outer('avg', 'sum', stat, bins, ticks)
# Desc: given a run, a stat and an array of samples, average the samples
def avg(self, stat, ticks):
return self.query('avg', *args, **kwargs)
# Name: stdev
# Desc: given a run, a stat and an array of samples and bins,
# sum all the bins and then get the standard deviation of the
# samples for non-binned runs. This will just return the average
# of samples, however a bin array still must be passed
def stdev(self, stat, bins, ticks):
return self.outer('stddev', 'sum', stat, bins, ticks)
# Desc: given a run, a stat and an array of samples, get the standard
# deviation
def stdev(self, stat, ticks):
return self.query('stddev', *args, **kwargs)
def __setattr__(self, attr, value):
super(Database, self).__setattr__(attr, value)
@ -471,12 +402,10 @@ class Database(object):
else:
raise AttributeError, "can only set get to: sum | avg | stdev"
def data(self, stat, bins=None, ticks=None):
if bins is None:
bins = self.bins
def data(self, stat, ticks=None):
if ticks is None:
ticks = self.ticks
sql = self._method(self, stat, bins, ticks)
sql = self._method(self, stat, ticks)
self.query(sql)
runs = {}

View file

@ -97,28 +97,6 @@ class MyDB(object):
UNIQUE (rn_name,rn_sample)
) TYPE=InnoDB''')
#
# We keep the bin names separate so that the data table doesn't get
# huge since bin names are frequently repeated.
#
# COLUMNS:
# 'id' is the unique bin identifer.
# 'name' is the string name for the bin.
#
# INDEXES:
# 'bin' is indexed to get the name of a bin when data is retrieved
# via the data table.
# 'name' is indexed to get the bin id for a named bin when you want
# to search the data table based on a specific bin.
#
self.query('''
CREATE TABLE bins(
bn_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
bn_name VARCHAR(255) NOT NULL,
PRIMARY KEY(bn_id),
UNIQUE (bn_name)
) TYPE=InnoDB''')
#
# The stat table gives us all of the data for a particular stat.
#
@ -220,14 +198,12 @@ class MyDB(object):
# 'run' is the run that the data was generated from. Details up in
# the run table
# 'tick' is a timestamp generated by the simulator.
# 'bin' is the name of the bin that the data was generated in, if
# any.
# 'data' is the actual stat value.
#
# INDEXES:
# 'stat' is indexed so that a user can find all of the data for a
# particular stat. It is not unique, because that specific stat
# can be found in many runs, bins, and samples, in addition to
# can be found in many runs and samples, in addition to
# having entries for the mulidimensional cases.
# 'run' is indexed to allow a user to remove all of the data for a
# particular execution run. It can also be used to allow the
@ -240,11 +216,10 @@ class MyDB(object):
dt_y SMALLINT NOT NULL,
dt_run SMALLINT UNSIGNED NOT NULL,
dt_tick BIGINT UNSIGNED NOT NULL,
dt_bin SMALLINT UNSIGNED NOT NULL,
dt_data DOUBLE NOT NULL,
INDEX (dt_stat),
INDEX (dt_run),
UNIQUE (dt_stat,dt_x,dt_y,dt_run,dt_tick,dt_bin)
UNIQUE (dt_stat,dt_x,dt_y,dt_run,dt_tick)
) TYPE=InnoDB;''')
#
@ -395,12 +370,6 @@ class MyDB(object):
LEFT JOIN data ON sd_stat=dt_stat
WHERE dt_stat IS NULL''')
self.query('''
DELETE bins
FROM bins
LEFT JOIN data ON bn_id=dt_bin
WHERE dt_bin IS NULL''')
self.query('''
DELETE events
FROM events

View file

@ -174,7 +174,7 @@ def WrapValue(value):
class Statistic(object):
def __getattr__(self, attr):
if attr in ('data', 'x', 'y'):
result = self.source.data(self, self.bins, self.ticks)
result = self.source.data(self, self.ticks)
self.data = result.data
self.x = result.x
self.y = result.y
@ -183,7 +183,7 @@ class Statistic(object):
def __setattr__(self, attr, value):
if attr == 'stat':
raise AttributeError, '%s is read only' % stat
if attr in ('source', 'bins', 'ticks'):
if attr in ('source', 'ticks'):
if getattr(self, attr) != value:
if hasattr(self, 'data'):
delattr(self, 'data')
@ -759,7 +759,6 @@ def NewStat(source, data):
stat = Formula()
stat.__dict__['source'] = source
stat.__dict__['bins'] = None
stat.__dict__['ticks'] = None
stat.__dict__.update(data.__dict__)

View file

@ -29,24 +29,16 @@
from chart import ChartOptions
class StatOutput(ChartOptions):
def __init__(self, jobfile, info, stat=None, binstats=None):
def __init__(self, jobfile, info, stat=None):
super(StatOutput, self).__init__()
self.jobfile = jobfile
self.stat = stat
self.binstats = None
self.invert = False
self.info = info
def printdata(self, name, bin = None, printmode = 'G'):
def display(self, name, printmode = 'G'):
import info
if bin:
print '%s %s stats' % (name, bin)
if self.binstats:
for stat in self.binstats:
stat.bins = bin
if printmode == 'G':
valformat = '%g'
elif printmode != 'F' and value > 1e6:
@ -70,16 +62,6 @@ class StatOutput(ChartOptions):
valstring = ', '.join([ valformat % val for val in value ])
print '%-50s %s' % (job.name + ':', valstring)
def display(self, name, binned = False, printmode = 'G'):
if binned and self.binstats:
self.printdata(name, 'kernel', printmode)
self.printdata(name, 'idle', printmode)
self.printdata(name, 'user', printmode)
self.printdata(name, 'interrupt', printmode)
print '%s total stats' % name
self.printdata(name, printmode=printmode)
def graph(self, name, graphdir, proxy=None):
from os.path import expanduser, isdir, join as joinpath
from barchart import BarChart

View file

@ -37,7 +37,6 @@ Usage: %s [-E] [-F] [ -G <get> ] [-d <db> ] [-g <graphdir> ] [-h <host>] [-p]
commands extra parameters description
----------- ------------------ ---------------------------------------
bins [regex] List bins (only matching regex)
formula <formula> Evaluated formula specified
formulas [regex] List formulas (only matching regex)
runs none List all runs in database
@ -140,16 +139,6 @@ def commands(options, command, args):
return
if command == 'bins':
if len(args) == 0:
source.listBins()
elif len(args) == 1:
source.listBins(args[0])
else:
raise CommandException
return
if command == 'formulas':
if len(args) == 0:
source.listFormulas()
@ -279,7 +268,7 @@ def commands(options, command, args):
if options.graph:
output.graph(stat.name, options.graphdir)
else:
output.display(stat.name, options.binned, options.printmode)
output.display(stat.name, options.printmode)
return
@ -299,22 +288,10 @@ def commands(options, command, args):
if options.graph:
output.graph(command, options.graphdir, proxy)
else:
output.display(command, options.binned, options.printmode)
if command == 'usertime':
import copy
user = copy.copy(system.run0.numCycles)
user.bins = 'user'
output.stat = user / system.run0.numCycles
output.ylabel = 'User Fraction'
display()
return
output.display(command, options.printmode)
if command == 'ticks':
output.stat = system.run0.numCycles
output.binstats = [ system.run0.numCycles ]
display()
return
@ -401,7 +378,6 @@ def commands(options, command, args):
if command == 'mpkb':
output.stat = misses / (bytes / 1024)
output.binstats = [ misses ]
output.ylabel = 'Misses / KB'
display()
return
@ -409,7 +385,6 @@ def commands(options, command, args):
if command == 'ipkb':
interrupts = system.run0.kern.faults[4]
output.stat = interrupts / kbytes
output.binstats = [ interrupts ]
output.ylabel = 'Interrupts / KB'
display()
return
@ -446,7 +421,6 @@ if __name__ == '__main__':
options.runs = None
options.system = 'client'
options.method = None
options.binned = False
options.graph = False
options.ticks = False
options.printmode = 'G'
@ -454,10 +428,8 @@ if __name__ == '__main__':
options.jobfile = None
options.all = False
opts, args = getopts(sys.argv[1:], '-BEFJad:g:h:j:m:pr:s:u:T:')
opts, args = getopts(sys.argv[1:], '-EFJad:g:h:j:m:pr:s:u:T:')
for o,a in opts:
if o == '-B':
options.binned = True
if o == '-E':
options.printmode = 'E'
if o == '-F':