Merge zizzer.eecs.umich.edu:/bk/newmem

into  iceaxe.:/Volumes/work/research/m5/newmem

--HG--
extra : convert_revision : e457e807b29d8ff88ac335cd50acd596e7e31eee
This commit is contained in:
Nathan Binkert 2006-06-11 23:02:50 -04:00
commit df4b4f001e
29 changed files with 672 additions and 1268 deletions

View file

@ -287,7 +287,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'])),
@ -304,8 +303,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

@ -219,7 +219,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

@ -109,10 +109,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)
@ -127,10 +123,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)
@ -148,9 +141,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

@ -137,24 +137,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()
@ -224,10 +206,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)
@ -242,10 +220,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)
@ -263,9 +238,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

@ -45,7 +45,7 @@ using namespace AlphaISA;
using namespace Linux;
/**
* 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.
*/
@ -124,18 +124,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

@ -232,10 +232,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)
@ -250,10 +246,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)
@ -271,9 +264,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

@ -107,9 +107,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)
@ -124,9 +121,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)
@ -144,9 +139,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

@ -43,7 +43,6 @@
#include "base/time.hh"
#include "base/trace.hh"
#include "base/stats/statdb.hh"
#include "config/stats_binning.hh"
using namespace std;
@ -174,12 +173,6 @@ FormulaBase::size() const
return root->size();
}
bool
FormulaBase::binned() const
{
return root && root->binned();
}
void
FormulaBase::reset()
{
@ -238,33 +231,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()
{
@ -287,13 +253,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;
@ -313,39 +272,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

@ -158,14 +158,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"
@ -309,52 +301,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];
@ -384,7 +330,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);
}
@ -402,9 +348,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
@ -656,29 +602,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
{
@ -697,11 +620,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

@ -39,7 +39,6 @@
namespace MySQL { class Connection; }
namespace Stats {
class MainBin;
class DistDataData;
class MySqlRun;
bool MySqlConnected();
@ -82,7 +81,6 @@ class InsertData
uint64_t tick;
double data;
uint16_t stat;
uint16_t bin;
int16_t x;
int16_t y;
@ -133,7 +131,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

@ -31,7 +31,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;
@ -50,17 +49,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

@ -40,31 +40,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

@ -129,23 +129,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

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

View file

@ -409,11 +409,6 @@ void
BaseSimpleCPU::postExecute()
{
#if FULL_SYSTEM
if (system->kernelBinning->fnbin) {
assert(thread->getKernelStats());
system->kernelBinning->execute(tc, inst);
}
if (thread->profile) {
bool usermode =
(thread->readMiscReg(AlphaISA::IPR_DTB_CM) & 0x18) != 0;

View file

@ -45,13 +45,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
@ -186,7 +185,7 @@ Statistics::regStats(const string &_name)
void
Statistics::setIdleProcess(Addr idlepcbb, ThreadContext *tc)
{
assert(themode == kernel || themode == interrupt);
assert(themode == kernel);
idleProcess = idlepcbb;
themode = idle;
changeMode(themode, tc);
@ -206,8 +205,6 @@ Statistics::changeMode(cpu_mode newmode, ThreadContext *tc)
_modeGood[newmode]++;
_modeTicks[themode] += curTick - lastModeTick;
tc->getSystemPtr()->kernelBinning->changeMode(newmode);
lastModeTick = curTick;
themode = newmode;
}
@ -233,13 +230,9 @@ Statistics::mode(cpu_mode newmode, ThreadContext *tc)
{
Addr pcbb = tc->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, tc);
}
@ -268,11 +261,6 @@ Statistics::callpal(int code, ThreadContext *tc)
_syscall[cvtnum]++;
}
} break;
case PAL::swpctx:
if (tc->getSystemPtr()->kernelBinning)
tc->getSystemPtr()->kernelBinning->palSwapContext(tc);
break;
}
}

View file

@ -47,95 +47,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(ThreadContext *tc);
void execute(ThreadContext *tc, StaticInstPtr inst);
void call(ThreadContext *tc, 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, ThreadContext *tc);

View file

@ -55,22 +55,6 @@ SkipFuncEvent::process(ThreadContext *tc)
*/
}
FnEvent::FnEvent(PCEventQueue *q, const std::string &desc, Addr addr,
Stats::MainBin *bin)
: PCEvent(q, desc, addr), _name(desc), mybin(bin)
{
}
void
FnEvent::process(ThreadContext *tc)
{
if (tc->misspeculating())
return;
tc->getSystemPtr()->kernelBinning->call(tc, mybin);
}
void
IdleStartEvent::process(ThreadContext *tc)
{
@ -79,19 +63,3 @@ IdleStartEvent::process(ThreadContext *tc)
tc->readMiscReg(AlphaISA::IPR_PALtemp23), tc);
remove();
}
void
InterruptStartEvent::process(ThreadContext *tc)
{
if (tc->getKernelStats())
tc->getKernelStats()->mode(Kernel::interrupt, tc);
}
void
InterruptEndEvent::process(ThreadContext *tc)
{
// 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 (tc->getKernelStats())
tc->getKernelStats()->mode(Kernel::kernel, tc);
}

View file

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

View file

@ -8,8 +8,6 @@ class System(SimObject):
boot_cpu_frequency = Param.Frequency(Self.cpu[0].clock.frequency,
"boot processor frequency")
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")
boot_osflags = Param.String("a", "boot flags to pass to the kernel")
kernel = Param.String("file that contains the kernel code")
readfile = Param.String("", "file to read startup script from")

View file

@ -132,8 +132,6 @@ System::~System()
#if FULL_SYSTEM
delete kernelSymtab;
delete kernel;
delete kernelBinning;
#else
panic("System::fixFuncEventAddr needs to be rewritten "
"to work with syscall emulation");
@ -219,20 +217,10 @@ System::new_page()
}
#endif
void
System::regStats()
{
#if FULL_SYSTEM
kernelBinning->regStats(name() + ".kern");
#endif // FULL_SYSTEM
}
void
System::serialize(ostream &os)
{
#if FULL_SYSTEM
kernelBinning->serialize(os);
kernelSymtab->serialize("kernel_symtab", os);
#endif // FULL_SYSTEM
}
@ -242,8 +230,6 @@ void
System::unserialize(Checkpoint *cp, const string &section)
{
#if FULL_SYSTEM
kernelBinning->unserialize(cp, section);
kernelSymtab->unserialize("kernel_symtab", cp, section);
#endif // FULL_SYSTEM
}

View file

@ -56,7 +56,6 @@ class PhysicalMemory;
class Platform;
class GDBListener;
class RemoteGDB;
namespace Kernel { class Binning; }
#endif
class System : public SimObject
@ -100,8 +99,6 @@ class System : public SimObject
/** Entry point in the kernel to start at */
Addr kernelEntry;
Kernel::Binning *kernelBinning;
#else
int page_ptr;
@ -161,9 +158,6 @@ class System : public SimObject
Tick boot_cpu_frequency;
std::string boot_osflags;
uint64_t init_param;
bool bin;
std::vector<std::string> binned_fns;
bool bin_int;
std::string kernel_path;
std::string readfile;
@ -211,7 +205,6 @@ class System : public SimObject
int registerThreadContext(ThreadContext *tc, int tcIndex);
void replaceThreadContext(ThreadContext *tc, int tcIndex);
void regStats();
void serialize(std::ostream &os);
void unserialize(Checkpoint *cp, const std::string &section);

View file

@ -50,10 +50,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;
@ -72,9 +72,6 @@ Value f5;
Formula f6;
Formula f7;
MainBin bin1("bin1");
MainBin bin2("bin2");
ostream *outputStream = &cout;
double
@ -303,8 +300,6 @@ main(int argc, char *argv[])
check();
reset();
bin1.activate();
s16[1][0] = 1;
s16[0][1] = 3;
s16[0][0] = 2;
@ -495,7 +490,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

@ -137,10 +137,6 @@ class Database(object):
self.allRunIds = {}
self.allRunNames = {}
self.allBins = []
self.allBinIds = {}
self.allBinNames = {}
self.allFormulas = {}
self.stattop = {}
@ -149,7 +145,6 @@ class Database(object):
self.mode = 'sum';
self.runs = None
self.bins = None
self.ticks = None
self.method = 'sum'
self._method = type(self).sum
@ -220,11 +215,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)
@ -247,18 +237,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
@ -362,39 +340,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, '
@ -416,10 +365,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
@ -429,35 +374,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)
@ -473,12 +404,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

@ -99,28 +99,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.
#
@ -222,14 +200,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
@ -242,11 +218,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;''')
#
@ -397,12 +372,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

@ -176,7 +176,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
@ -185,7 +185,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')
@ -761,7 +761,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

@ -39,7 +39,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
@ -142,16 +141,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()
@ -281,7 +270,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
@ -301,22 +290,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
@ -403,7 +380,6 @@ def commands(options, command, args):
if command == 'mpkb':
output.stat = misses / (bytes / 1024)
output.binstats = [ misses ]
output.ylabel = 'Misses / KB'
display()
return
@ -411,7 +387,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
@ -448,7 +423,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'
@ -456,10 +430,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':