Merge iceaxe.:/Volumes/work/research/m5/head

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

src/cpu/simple/base.cc:
src/kern/kernel_stats.cc:
src/kern/kernel_stats.hh:
src/kern/system_events.cc:
src/kern/system_events.hh:
src/python/m5/objects/System.py:
src/sim/system.cc:
src/sim/system.hh:
    hand merge

--HG--
rename : build/SConstruct => SConstruct
rename : SConscript => src/SConscript
rename : arch/alpha/freebsd/system.cc => src/arch/alpha/freebsd/system.cc
rename : arch/alpha/linux/system.cc => src/arch/alpha/linux/system.cc
rename : arch/alpha/linux/system.hh => src/arch/alpha/linux/system.hh
rename : arch/alpha/system.cc => src/arch/alpha/system.cc
rename : arch/alpha/tru64/system.cc => src/arch/alpha/tru64/system.cc
rename : base/statistics.cc => src/base/statistics.cc
rename : base/statistics.hh => src/base/statistics.hh
rename : base/stats/mysql.cc => src/base/stats/mysql.cc
rename : base/stats/mysql.hh => src/base/stats/mysql.hh
rename : base/stats/statdb.cc => src/base/stats/statdb.cc
rename : base/stats/statdb.hh => src/base/stats/statdb.hh
rename : base/stats/text.cc => src/base/stats/text.cc
rename : base/stats/text.hh => src/base/stats/text.hh
rename : cpu/simple/cpu.cc => src/cpu/simple/base.cc
rename : kern/kernel_stats.cc => src/kern/kernel_stats.cc
rename : kern/kernel_stats.hh => src/kern/kernel_stats.hh
rename : kern/system_events.cc => src/kern/system_events.cc
rename : kern/system_events.hh => src/kern/system_events.hh
rename : python/m5/objects/System.py => src/python/m5/objects/System.py
rename : sim/system.cc => src/sim/system.cc
rename : sim/system.hh => src/sim/system.hh
rename : test/stattest.cc => src/unittest/stattest.cc
extra : convert_revision : 4bb576a2bf5e32784efc48030bd776c6c7c29a7c
This commit is contained in:
Nathan Binkert 2006-06-11 22:01:34 -04:00
commit 3c95f5958f
29 changed files with 672 additions and 1268 deletions

View file

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

View file

@ -219,7 +219,6 @@ full_system_sources = Split('''
dev/uart.cc dev/uart.cc
dev/uart8250.cc dev/uart8250.cc
kern/kernel_binning.cc
kern/kernel_stats.cc kern/kernel_stats.cc
kern/system_events.cc kern/system_events.cc
kern/linux/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_type;
Param<uint64_t> system_rev; Param<uint64_t> system_rev;
Param<bool> bin;
VectorParam<string> binned_fns;
Param<bool> bin_int;
END_DECLARE_SIM_OBJECT_PARAMS(FreebsdAlphaSystem) END_DECLARE_SIM_OBJECT_PARAMS(FreebsdAlphaSystem)
BEGIN_INIT_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(readfile, "file to read startup script from", ""),
INIT_PARAM_DFLT(init_param, "numerical value to pass into simulator", 0), 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_type, "Type of system we are emulating", 34),
INIT_PARAM_DFLT(system_rev, "Revision of system we are emulating", 1<<10), 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)
END_INIT_SIM_OBJECT_PARAMS(FreebsdAlphaSystem) END_INIT_SIM_OBJECT_PARAMS(FreebsdAlphaSystem)
@ -148,9 +141,6 @@ CREATE_SIM_OBJECT(FreebsdAlphaSystem)
p->readfile = readfile; p->readfile = readfile;
p->system_type = system_type; p->system_type = system_type;
p->system_rev = system_rev; p->system_rev = system_rev;
p->bin = bin;
p->binned_fns = binned_fns;
p->bin_int = bin_int;
return new FreebsdAlphaSystem(p); return new FreebsdAlphaSystem(p);
} }

View file

@ -137,24 +137,6 @@ LinuxAlphaSystem::LinuxAlphaSystem(Params *p)
} else { } else {
printThreadEvent = NULL; 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() LinuxAlphaSystem::~LinuxAlphaSystem()
@ -224,10 +206,6 @@ BEGIN_DECLARE_SIM_OBJECT_PARAMS(LinuxAlphaSystem)
Param<uint64_t> system_type; Param<uint64_t> system_type;
Param<uint64_t> system_rev; Param<uint64_t> system_rev;
Param<bool> bin;
VectorParam<string> binned_fns;
Param<bool> bin_int;
END_DECLARE_SIM_OBJECT_PARAMS(LinuxAlphaSystem) END_DECLARE_SIM_OBJECT_PARAMS(LinuxAlphaSystem)
BEGIN_INIT_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(readfile, "file to read startup script from", ""),
INIT_PARAM_DFLT(init_param, "numerical value to pass into simulator", 0), 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_type, "Type of system we are emulating", 34),
INIT_PARAM_DFLT(system_rev, "Revision of system we are emulating", 1<<10), 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)
END_INIT_SIM_OBJECT_PARAMS(LinuxAlphaSystem) END_INIT_SIM_OBJECT_PARAMS(LinuxAlphaSystem)
@ -263,9 +238,6 @@ CREATE_SIM_OBJECT(LinuxAlphaSystem)
p->readfile = readfile; p->readfile = readfile;
p->system_type = system_type; p->system_type = system_type;
p->system_rev = system_rev; p->system_rev = system_rev;
p->bin = bin;
p->binned_fns = binned_fns;
p->bin_int = bin_int;
return new LinuxAlphaSystem(p); return new LinuxAlphaSystem(p);
} }

View file

@ -45,7 +45,7 @@ using namespace AlphaISA;
using namespace Linux; 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 * It points to objects that are the system binaries to load and patches them
* appropriately to work in simulator. * appropriately to work in simulator.
*/ */
@ -124,18 +124,6 @@ class LinuxAlphaSystem : public AlphaSystem
*/ */
PrintThreadInfo *printThreadEvent; 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 */ /** Grab the PCBB of the idle process when it starts */
IdleStartEvent *idleStartEvent; IdleStartEvent *idleStartEvent;

View file

@ -232,10 +232,6 @@ BEGIN_DECLARE_SIM_OBJECT_PARAMS(AlphaSystem)
Param<uint64_t> system_type; Param<uint64_t> system_type;
Param<uint64_t> system_rev; Param<uint64_t> system_rev;
Param<bool> bin;
VectorParam<std::string> binned_fns;
Param<bool> bin_int;
END_DECLARE_SIM_OBJECT_PARAMS(AlphaSystem) END_DECLARE_SIM_OBJECT_PARAMS(AlphaSystem)
BEGIN_INIT_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(readfile, "file to read startup script from", ""),
INIT_PARAM_DFLT(init_param, "numerical value to pass into simulator", 0), 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_type, "Type of system we are emulating", 34),
INIT_PARAM_DFLT(system_rev, "Revision of system we are emulating", 1<<10), 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)
END_INIT_SIM_OBJECT_PARAMS(AlphaSystem) END_INIT_SIM_OBJECT_PARAMS(AlphaSystem)
@ -271,9 +264,6 @@ CREATE_SIM_OBJECT(AlphaSystem)
p->readfile = readfile; p->readfile = readfile;
p->system_type = system_type; p->system_type = system_type;
p->system_rev = system_rev; p->system_rev = system_rev;
p->bin = bin;
p->binned_fns = binned_fns;
p->bin_int = bin_int;
return new AlphaSystem(p); 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_type;
Param<uint64_t> system_rev; Param<uint64_t> system_rev;
Param<bool> bin;
VectorParam<string> binned_fns;
END_DECLARE_SIM_OBJECT_PARAMS(Tru64AlphaSystem) END_DECLARE_SIM_OBJECT_PARAMS(Tru64AlphaSystem)
BEGIN_INIT_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(readfile, "file to read startup script from", ""),
INIT_PARAM_DFLT(init_param, "numerical value to pass into simulator", 0), 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_type, "Type of system we are emulating", 12),
INIT_PARAM_DFLT(system_rev, "Revision of system we are emulating", 2<<1), 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")
END_INIT_SIM_OBJECT_PARAMS(Tru64AlphaSystem) END_INIT_SIM_OBJECT_PARAMS(Tru64AlphaSystem)
@ -144,9 +139,6 @@ CREATE_SIM_OBJECT(Tru64AlphaSystem)
p->readfile = readfile; p->readfile = readfile;
p->system_type = system_type; p->system_type = system_type;
p->system_rev = system_rev; p->system_rev = system_rev;
p->bin = bin;
p->binned_fns = binned_fns;
p->bin_int = false;
return new Tru64AlphaSystem(p); return new Tru64AlphaSystem(p);
} }

View file

@ -43,7 +43,6 @@
#include "base/time.hh" #include "base/time.hh"
#include "base/trace.hh" #include "base/trace.hh"
#include "base/stats/statdb.hh" #include "base/stats/statdb.hh"
#include "config/stats_binning.hh"
using namespace std; using namespace std;
@ -174,12 +173,6 @@ FormulaBase::size() const
return root->size(); return root->size();
} }
bool
FormulaBase::binned() const
{
return root && root->binned();
}
void void
FormulaBase::reset() FormulaBase::reset()
{ {
@ -238,33 +231,6 @@ Formula::operator+=(Temp r)
return *this; 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 void
check() check()
{ {
@ -287,13 +253,6 @@ check()
Database::stats().sort(StatData::less); Database::stats().sort(StatData::less);
#if STATS_BINNING
if (MainBin::curBin() == NULL) {
static MainBin mainBin("main bin");
mainBin.activate();
}
#endif
if (i == end) if (i == end)
return; return;
@ -313,39 +272,14 @@ CallbackQueue resetQueue;
void void
reset() reset()
{ {
// reset non-binned stats
Database::stat_list_t::iterator i = Database::stats().begin(); Database::stat_list_t::iterator i = Database::stats().begin();
Database::stat_list_t::iterator end = Database::stats().end(); Database::stat_list_t::iterator end = Database::stats().end();
while (i != end) { while (i != end) {
StatData *data = *i; StatData *data = *i;
if (!data->binned()) data->reset();
data->reset();
++i; ++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(); resetQueue.process();
} }

File diff suppressed because it is too large Load diff

View file

@ -158,14 +158,6 @@ MySqlRun::cleanup()
if (mysql.commit()) if (mysql.commit())
panic("could not commit transaction\n%s\n", mysql.error); 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" mysql.query("DELETE events"
"FROM events" "FROM events"
"LEFT JOIN runs ON ev_run=rn_id" "LEFT JOIN runs ON ev_run=rn_id"
@ -309,52 +301,6 @@ SetupStat::setup()
return statid; 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() InsertData::InsertData()
{ {
query = new char[maxsize + 1]; query = new char[maxsize + 1];
@ -384,7 +330,7 @@ InsertData::flush()
size = 0; size = 0;
first = true; first = true;
strcpy(query, "INSERT INTO " 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"); "values");
size = strlen(query); size = strlen(query);
} }
@ -402,9 +348,9 @@ InsertData::insert()
first = false; 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, stat, x, y, MySqlDB.run(), (unsigned long long)tick,
bin, data); data);
} }
struct InsertSubData struct InsertSubData
@ -656,29 +602,6 @@ MySql::configure(const FormulaData &data)
InsertFormula(find(data.id), data.str()); 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 bool
MySql::valid() const MySql::valid() const
{ {
@ -697,11 +620,14 @@ MySql::output()
// store sample # // store sample #
newdata.tick = curTick; newdata.tick = curTick;
output(NULL); MySQL::Connection &mysql = MySqlDB.conn();
if (!bins().empty()) {
bin_list_t::iterator i, end = bins().end(); Database::stat_list_t::const_iterator i, end = Database::stats().end();
for (i = bins().begin(); i != end; ++i) for (i = Database::stats().begin(); i != end; ++i) {
output(*i); StatData *stat = *i;
stat->visit(*this);
if (mysql.commit())
panic("could not commit transaction\n%s\n", mysql.error);
} }
newdata.flush(); newdata.flush();

View file

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

View file

@ -31,7 +31,6 @@
#include "base/misc.hh" #include "base/misc.hh"
#include "base/trace.hh" #include "base/trace.hh"
#include "base/statistics.hh" #include "base/statistics.hh"
#include "base/stats/bin.hh"
#include "base/stats/statdb.hh" #include "base/stats/statdb.hh"
using namespace std; using namespace std;
@ -50,17 +49,6 @@ find(void *stat)
return (*i).second; 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 void
regStat(void *stat, StatData *data) regStat(void *stat, StatData *data)
{ {

View file

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

View file

@ -129,23 +129,9 @@ Text::output()
using namespace Database; using namespace Database;
ccprintf(*stream, "\n---------- Begin Simulation Statistics ----------\n"); ccprintf(*stream, "\n---------- Begin Simulation Statistics ----------\n");
if (bins().empty() || bins().size() == 1) { stat_list_t::const_iterator i, end = stats().end();
stat_list_t::const_iterator i, end = stats().end(); for (i = stats().begin(); i != end; ++i)
for (i = stats().begin(); i != end; ++i) (*i)->visit(*this);
(*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");
}
}
ccprintf(*stream, "\n---------- End Simulation Statistics ----------\n"); ccprintf(*stream, "\n---------- End Simulation Statistics ----------\n");
stream->flush(); stream->flush();
} }

View file

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

View file

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

View file

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

View file

@ -47,95 +47,17 @@ class System;
namespace Kernel { 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[]; 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 class Statistics : public Serializable
{ {
private:
friend class Binning;
private: private:
std::string myname; std::string myname;
Addr idleProcess; Addr idleProcess;
cpu_mode themode; cpu_mode themode;
Tick lastModeTick; Tick lastModeTick;
bool bin_int;
void changeMode(cpu_mode newmode, ThreadContext *tc); 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 void
IdleStartEvent::process(ThreadContext *tc) IdleStartEvent::process(ThreadContext *tc)
{ {
@ -79,19 +63,3 @@ IdleStartEvent::process(ThreadContext *tc)
tc->readMiscReg(AlphaISA::IPR_PALtemp23), tc); tc->readMiscReg(AlphaISA::IPR_PALtemp23), tc);
remove(); 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); 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 class IdleStartEvent : public PCEvent
{ {
public: public:
@ -67,23 +54,4 @@ class IdleStartEvent : public PCEvent
virtual void process(ThreadContext *tc); 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__ #endif // __SYSTEM_EVENTS_HH__

View file

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

View file

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

View file

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

View file

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

View file

@ -137,10 +137,6 @@ class Database(object):
self.allRunIds = {} self.allRunIds = {}
self.allRunNames = {} self.allRunNames = {}
self.allBins = []
self.allBinIds = {}
self.allBinNames = {}
self.allFormulas = {} self.allFormulas = {}
self.stattop = {} self.stattop = {}
@ -149,7 +145,6 @@ class Database(object):
self.mode = 'sum'; self.mode = 'sum';
self.runs = None self.runs = None
self.bins = None
self.ticks = None self.ticks = None
self.method = 'sum' self.method = 'sum'
self._method = type(self).sum self._method = type(self).sum
@ -220,11 +215,6 @@ class Database(object):
self.allRunIds[run.run] = run self.allRunIds[run.run] = run
self.allRunNames[run.name] = 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') self.query('select sd_stat,sd_x,sd_y,sd_name,sd_descr from subdata')
for result in self.cursor.fetchall(): for result in self.cursor.fetchall():
subdata = SubData(result) subdata = SubData(result)
@ -247,18 +237,6 @@ class Database(object):
self.allStatIds[stat.stat] = stat self.allStatIds[stat.stat] = stat
self.allStatNames[stat.name] = 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 # Name: listruns
# Desc: Prints all runs matching a given user, if no argument # Desc: Prints all runs matching a given user, if no argument
# is given all runs are returned # is given all runs are returned
@ -362,39 +340,10 @@ class Database(object):
ret.append(stat) ret.append(stat)
return ret 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 # get the data
# #
def inner(self, op, stat, bins, ticks, group=False): def query(self, op, stat, ticks, group=False):
sql = 'select ' sql = 'select '
sql += 'dt_stat as stat, ' sql += 'dt_stat as stat, '
sql += 'dt_run as run, ' sql += 'dt_run as run, '
@ -416,10 +365,6 @@ class Database(object):
val = ' or '.join([ 'dt_run=%d' % r for r in self.runs ]) val = ' or '.join([ 'dt_run=%d' % r for r in self.runs ])
sql += ' and (%s)' % val 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): if ticks != None and len(ticks):
val = ' or '.join([ 'dt_tick=%d' % s for s in ticks ]) val = ' or '.join([ 'dt_tick=%d' % s for s in ticks ])
sql += ' and (%s)' % val sql += ' and (%s)' % val
@ -429,35 +374,21 @@ class Database(object):
sql += ',dt_tick' sql += ',dt_tick'
return sql 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 # Name: sum
# Desc: given a run, a stat and an array of samples and bins, # Desc: given a run, a stat and an array of samples, total the samples
# sum all the bins and then get the standard deviation of the def sum(self, *args, **kwargs):
# samples for non-binned runs. This will just return the average return self.query('sum', *args, **kwargs)
# of samples, however a bin array still must be passed
def sum(self, stat, bins, ticks):
return self.inner('sum', stat, bins, ticks)
# Name: avg # Name: avg
# Desc: given a run, a stat and an array of samples and bins, # Desc: given a run, a stat and an array of samples, average the samples
# sum all the bins and then average the samples for non-binned def avg(self, stat, ticks):
# runs this will just return the average of samples, however return self.query('avg', *args, **kwargs)
# a bin array still must be passed
def avg(self, stat, bins, ticks):
return self.outer('avg', 'sum', stat, bins, ticks)
# Name: stdev # Name: stdev
# Desc: given a run, a stat and an array of samples and bins, # Desc: given a run, a stat and an array of samples, get the standard
# sum all the bins and then get the standard deviation of the # deviation
# samples for non-binned runs. This will just return the average def stdev(self, stat, ticks):
# of samples, however a bin array still must be passed return self.query('stddev', *args, **kwargs)
def stdev(self, stat, bins, ticks):
return self.outer('stddev', 'sum', stat, bins, ticks)
def __setattr__(self, attr, value): def __setattr__(self, attr, value):
super(Database, self).__setattr__(attr, value) super(Database, self).__setattr__(attr, value)
@ -473,12 +404,10 @@ class Database(object):
else: else:
raise AttributeError, "can only set get to: sum | avg | stdev" raise AttributeError, "can only set get to: sum | avg | stdev"
def data(self, stat, bins=None, ticks=None): def data(self, stat, ticks=None):
if bins is None:
bins = self.bins
if ticks is None: if ticks is None:
ticks = self.ticks ticks = self.ticks
sql = self._method(self, stat, bins, ticks) sql = self._method(self, stat, ticks)
self.query(sql) self.query(sql)
runs = {} runs = {}

View file

@ -99,28 +99,6 @@ class MyDB(object):
UNIQUE (rn_name,rn_sample) UNIQUE (rn_name,rn_sample)
) TYPE=InnoDB''') ) 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. # 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 # 'run' is the run that the data was generated from. Details up in
# the run table # the run table
# 'tick' is a timestamp generated by the simulator. # '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. # 'data' is the actual stat value.
# #
# INDEXES: # INDEXES:
# 'stat' is indexed so that a user can find all of the data for a # '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 # 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. # having entries for the mulidimensional cases.
# 'run' is indexed to allow a user to remove all of the data for a # '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 # particular execution run. It can also be used to allow the
@ -242,11 +218,10 @@ class MyDB(object):
dt_y SMALLINT NOT NULL, dt_y SMALLINT NOT NULL,
dt_run SMALLINT UNSIGNED NOT NULL, dt_run SMALLINT UNSIGNED NOT NULL,
dt_tick BIGINT UNSIGNED NOT NULL, dt_tick BIGINT UNSIGNED NOT NULL,
dt_bin SMALLINT UNSIGNED NOT NULL,
dt_data DOUBLE NOT NULL, dt_data DOUBLE NOT NULL,
INDEX (dt_stat), INDEX (dt_stat),
INDEX (dt_run), 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;''') ) TYPE=InnoDB;''')
# #
@ -397,12 +372,6 @@ class MyDB(object):
LEFT JOIN data ON sd_stat=dt_stat LEFT JOIN data ON sd_stat=dt_stat
WHERE dt_stat IS NULL''') 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(''' self.query('''
DELETE events DELETE events
FROM events FROM events

View file

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

View file

@ -29,24 +29,16 @@
from chart import ChartOptions from chart import ChartOptions
class StatOutput(ChartOptions): class StatOutput(ChartOptions):
def __init__(self, jobfile, info, stat=None, binstats=None): def __init__(self, jobfile, info, stat=None):
super(StatOutput, self).__init__() super(StatOutput, self).__init__()
self.jobfile = jobfile self.jobfile = jobfile
self.stat = stat self.stat = stat
self.binstats = None
self.invert = False self.invert = False
self.info = info self.info = info
def printdata(self, name, bin = None, printmode = 'G'): def display(self, name, printmode = 'G'):
import info import info
if bin:
print '%s %s stats' % (name, bin)
if self.binstats:
for stat in self.binstats:
stat.bins = bin
if printmode == 'G': if printmode == 'G':
valformat = '%g' valformat = '%g'
elif printmode != 'F' and value > 1e6: elif printmode != 'F' and value > 1e6:
@ -70,16 +62,6 @@ class StatOutput(ChartOptions):
valstring = ', '.join([ valformat % val for val in value ]) valstring = ', '.join([ valformat % val for val in value ])
print '%-50s %s' % (job.name + ':', valstring) 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): def graph(self, name, graphdir, proxy=None):
from os.path import expanduser, isdir, join as joinpath from os.path import expanduser, isdir, join as joinpath
from barchart import BarChart 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 commands extra parameters description
----------- ------------------ --------------------------------------- ----------- ------------------ ---------------------------------------
bins [regex] List bins (only matching regex)
formula <formula> Evaluated formula specified formula <formula> Evaluated formula specified
formulas [regex] List formulas (only matching regex) formulas [regex] List formulas (only matching regex)
runs none List all runs in database runs none List all runs in database
@ -142,16 +141,6 @@ def commands(options, command, args):
return 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 command == 'formulas':
if len(args) == 0: if len(args) == 0:
source.listFormulas() source.listFormulas()
@ -281,7 +270,7 @@ def commands(options, command, args):
if options.graph: if options.graph:
output.graph(stat.name, options.graphdir) output.graph(stat.name, options.graphdir)
else: else:
output.display(stat.name, options.binned, options.printmode) output.display(stat.name, options.printmode)
return return
@ -301,22 +290,10 @@ def commands(options, command, args):
if options.graph: if options.graph:
output.graph(command, options.graphdir, proxy) output.graph(command, options.graphdir, proxy)
else: else:
output.display(command, options.binned, options.printmode) output.display(command, 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
if command == 'ticks': if command == 'ticks':
output.stat = system.run0.numCycles output.stat = system.run0.numCycles
output.binstats = [ system.run0.numCycles ]
display() display()
return return
@ -403,7 +380,6 @@ def commands(options, command, args):
if command == 'mpkb': if command == 'mpkb':
output.stat = misses / (bytes / 1024) output.stat = misses / (bytes / 1024)
output.binstats = [ misses ]
output.ylabel = 'Misses / KB' output.ylabel = 'Misses / KB'
display() display()
return return
@ -411,7 +387,6 @@ def commands(options, command, args):
if command == 'ipkb': if command == 'ipkb':
interrupts = system.run0.kern.faults[4] interrupts = system.run0.kern.faults[4]
output.stat = interrupts / kbytes output.stat = interrupts / kbytes
output.binstats = [ interrupts ]
output.ylabel = 'Interrupts / KB' output.ylabel = 'Interrupts / KB'
display() display()
return return
@ -448,7 +423,6 @@ if __name__ == '__main__':
options.runs = None options.runs = None
options.system = 'client' options.system = 'client'
options.method = None options.method = None
options.binned = False
options.graph = False options.graph = False
options.ticks = False options.ticks = False
options.printmode = 'G' options.printmode = 'G'
@ -456,10 +430,8 @@ if __name__ == '__main__':
options.jobfile = None options.jobfile = None
options.all = False 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: for o,a in opts:
if o == '-B':
options.binned = True
if o == '-E': if o == '-E':
options.printmode = 'E' options.printmode = 'E'
if o == '-F': if o == '-F':