Merge zizzer.eecs.umich.edu:/bk/newmem
into iceaxe.:/Volumes/work/research/m5/newmem --HG-- extra : convert_revision : e457e807b29d8ff88ac335cd50acd596e7e31eee
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ class Text : public Output
|
||||
|
||||
protected:
|
||||
bool noOutput(const StatData &data);
|
||||
void binout();
|
||||
|
||||
public:
|
||||
bool compat;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 §ion);
|
||||
};
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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__
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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 §ion)
|
||||
{
|
||||
#if FULL_SYSTEM
|
||||
kernelBinning->unserialize(cp, section);
|
||||
|
||||
kernelSymtab->unserialize("kernel_symtab", cp, section);
|
||||
#endif // FULL_SYSTEM
|
||||
}
|
||||
|
||||
@@ -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 §ion);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user