Merge zizzer:/bk/m5 into isabel.reinhardt.house:/z/stever/bk/m5

--HG--
extra : convert_revision : 4dae71fe3482737a22745b27c2ca6983191c4a18
This commit is contained in:
Steve Reinhardt 2004-05-17 12:10:28 -07:00
commit 02af86f7e8
4 changed files with 94 additions and 88 deletions

View file

@ -49,7 +49,7 @@ Tru64System::Tru64System(const string _name, const uint64_t _init_param,
const string &kernel_path, const string &console_path, const string &kernel_path, const string &console_path,
const string &palcode, const string &boot_osflags, const string &palcode, const string &boot_osflags,
const bool _bin, const vector<string> &binned_fns) const bool _bin, const vector<string> &binned_fns)
: System(_name, _init_param, _memCtrl, _physmem, _bin), : System(_name, _init_param, _memCtrl, _physmem, _bin, binned_fns),
bin(_bin), binned_fns(binned_fns) bin(_bin), binned_fns(binned_fns)
{ {
kernelSymtab = new SymbolTable; kernelSymtab = new SymbolTable;
@ -163,33 +163,14 @@ Tru64System::Tru64System(const string _name, const uint64_t _init_param,
// BINNING STUFF // BINNING STUFF
if (bin == true) { if (bin == true) {
int end = binned_fns.size(); int end = binned_fns.size();
assert(!(end & 1));
Statistics::MainBin *Bin;
Addr address = 0; Addr address = 0;
fnEvents.resize(end>>1);
for (int i = 0; i < end; i +=2) { for (int i = 0; i < end; i +=2) {
Bin = new Statistics::MainBin(binned_fns[i]);
fnBins.insert(make_pair(binned_fns[i], Bin));
fnEvents[(i>>1)] = new FnEvent(&pcEventQueue, binned_fns[i], this);
if (kernelSymtab->findAddress(binned_fns[i], address)) if (kernelSymtab->findAddress(binned_fns[i], address))
fnEvents[(i>>1)]->schedule(address); fnEvents[(i>>1)]->schedule(address);
else else
panic("could not find kernel symbol %s\n", binned_fns[i]); panic("could not find kernel symbol %s\n", binned_fns[i]);
if (binned_fns[i+1] == "null")
populateMap(binned_fns[i], "");
else
populateMap(binned_fns[i], binned_fns[i+1]);
} }
fnCalls
.name(name() + ":fnCalls")
.desc("all fn calls being tracked")
;
} }
// //
} }
@ -213,14 +194,6 @@ Tru64System::~Tru64System()
delete debugPrintfEvent; delete debugPrintfEvent;
delete debugPrintfrEvent; delete debugPrintfrEvent;
delete dumpMbufEvent; delete dumpMbufEvent;
if (bin == true) {
int end = fnEvents.size();
for (int i = 0; i < end; ++i) {
delete fnEvents[i];
}
fnEvents.clear();
}
} }
int int
@ -261,45 +234,6 @@ Tru64System::breakpoint()
return remoteGDB[0]->trap(ALPHA_KENTRY_INT); return remoteGDB[0]->trap(ALPHA_KENTRY_INT);
} }
void
Tru64System::populateMap(std::string callee, std::string caller)
{
multimap<const string, string>::const_iterator i;
i = callerMap.insert(make_pair(callee, caller));
assert(i != callerMap.end() && "should not fail populating callerMap");
}
bool
Tru64System::findCaller(std::string callee, std::string caller) const
{
typedef multimap<const std::string, std::string>::const_iterator iter;
pair<iter, iter> range;
range = callerMap.equal_range(callee);
for (iter i = range.first; i != range.second; ++i) {
if ((*i).second == caller)
return true;
}
return false;
}
void
Tru64System::dumpState(ExecContext *xc) const
{
if (xc->swCtx) {
stack<fnCall *> copy(xc->swCtx->callStack);
if (copy.empty())
return;
DPRINTF(TCPIP, "xc->swCtx, size: %d:\n", copy.size());
fnCall *top;
DPRINTF(TCPIP, "|| call : %d\n",xc->swCtx->calls);
for (top = copy.top(); !copy.empty(); copy.pop() ) {
top = copy.top();
DPRINTF(TCPIP, "|| %13s : %s \n", top->name, top->myBin->name());
}
}
}
BEGIN_DECLARE_SIM_OBJECT_PARAMS(Tru64System) BEGIN_DECLARE_SIM_OBJECT_PARAMS(Tru64System)
Param<bool> bin; Param<bool> bin;

View file

@ -67,8 +67,6 @@ class Tru64System : public System
DebugPrintfEvent *debugPrintfrEvent; DebugPrintfEvent *debugPrintfrEvent;
DumpMbufEvent *dumpMbufEvent; DumpMbufEvent *dumpMbufEvent;
std::vector<FnEvent *> fnEvents;
private: private:
Addr kernelStart; Addr kernelStart;
@ -104,17 +102,6 @@ class Tru64System : public System
static void Printf(AlphaArguments args); static void Printf(AlphaArguments args);
static void DumpMbuf(AlphaArguments args); static void DumpMbuf(AlphaArguments args);
// Lisa's binning stuff
private:
std::multimap<const std::string, std::string> callerMap;
void populateMap(std::string caller, std::string callee);
public:
bool findCaller(std::string callee, std::string caller) const;
void dumpState(ExecContext *xc) const;
//
}; };
#endif // __TRU64_SYSTEM_HH__ #endif // __TRU64_SYSTEM_HH__

View file

@ -30,6 +30,7 @@
#include "targetarch/vtophys.hh" #include "targetarch/vtophys.hh"
#include "sim/param.hh" #include "sim/param.hh"
#include "sim/system.hh" #include "sim/system.hh"
#include "base/trace.hh"
using namespace std; using namespace std;
@ -41,12 +42,15 @@ System::System(const std::string _name,
const uint64_t _init_param, const uint64_t _init_param,
MemoryController *_memCtrl, MemoryController *_memCtrl,
PhysicalMemory *_physmem, PhysicalMemory *_physmem,
const bool _bin) const bool _bin,
const std::vector<string> &binned_fns)
: SimObject(_name), : SimObject(_name),
init_param(_init_param), init_param(_init_param),
memCtrl(_memCtrl), memCtrl(_memCtrl),
physmem(_physmem), physmem(_physmem),
bin(_bin) bin(_bin),
binned_fns(binned_fns)
{ {
// add self to global system list // add self to global system list
systemList.push_back(this); systemList.push_back(this);
@ -54,6 +58,31 @@ System::System(const std::string _name,
Kernel = new Statistics::MainBin("non TCPIP Kernel stats"); Kernel = new Statistics::MainBin("non TCPIP Kernel stats");
Kernel->activate(); Kernel->activate();
User = new Statistics::MainBin("User stats"); User = new Statistics::MainBin("User stats");
int end = binned_fns.size();
assert(!(end & 1));
Statistics::MainBin *Bin;
fnEvents.resize(end>>1);
for (int i = 0; i < end; i +=2) {
Bin = new Statistics::MainBin(binned_fns[i]);
fnBins.insert(make_pair(binned_fns[i], Bin));
fnEvents[(i>>1)] = new FnEvent(&pcEventQueue, binned_fns[i], this);
if (binned_fns[i+1] == "null")
populateMap(binned_fns[i], "");
else
populateMap(binned_fns[i], binned_fns[i+1]);
}
fnCalls
.name(name() + ":fnCalls")
.desc("all fn calls being tracked")
;
} else } else
Kernel = NULL; Kernel = NULL;
} }
@ -61,6 +90,13 @@ System::System(const std::string _name,
System::~System() System::~System()
{ {
if (bin == true) {
int end = fnEvents.size();
for (int i = 0; i < end; ++i) {
delete fnEvents[i];
}
fnEvents.clear();
}
} }
@ -103,6 +139,45 @@ printSystems()
System::printSystems(); System::printSystems();
} }
void
System::populateMap(std::string callee, std::string caller)
{
multimap<const string, string>::const_iterator i;
i = callerMap.insert(make_pair(callee, caller));
assert(i != callerMap.end() && "should not fail populating callerMap");
}
bool
System::findCaller(std::string callee, std::string caller) const
{
typedef multimap<const std::string, std::string>::const_iterator iter;
pair<iter, iter> range;
range = callerMap.equal_range(callee);
for (iter i = range.first; i != range.second; ++i) {
if ((*i).second == caller)
return true;
}
return false;
}
void
System::dumpState(ExecContext *xc) const
{
if (xc->swCtx) {
stack<fnCall *> copy(xc->swCtx->callStack);
if (copy.empty())
return;
DPRINTF(TCPIP, "xc->swCtx, size: %d:\n", copy.size());
fnCall *top;
DPRINTF(TCPIP, "|| call : %d\n",xc->swCtx->calls);
for (top = copy.top(); !copy.empty(); copy.pop() ) {
top = copy.top();
DPRINTF(TCPIP, "|| %13s : %s \n", top->name, top->myBin->name());
}
}
}
Statistics::MainBin * Statistics::MainBin *
System::getBin(const std::string &name) System::getBin(const std::string &name)
{ {

View file

@ -35,6 +35,7 @@
#include "base/loader/symtab.hh" #include "base/loader/symtab.hh"
#include "base/statistics.hh" #include "base/statistics.hh"
#include "cpu/pc_event.hh" #include "cpu/pc_event.hh"
#include "kern/system_events.hh"
#include "sim/sim_object.hh" #include "sim/sim_object.hh"
#include "sim/sw_context.hh" #include "sim/sw_context.hh"
@ -48,17 +49,20 @@ class ExecContext;
class System : public SimObject class System : public SimObject
{ {
// lisa's binning stuff // lisa's binning stuff
protected: private:
std::map<const std::string, Statistics::MainBin *> fnBins; std::map<const std::string, Statistics::MainBin *> fnBins;
std::map<const Addr, SWContext *> swCtxMap; std::map<const Addr, SWContext *> swCtxMap;
protected:
std::vector<FnEvent *> fnEvents;
public: public:
Statistics::Scalar<> fnCalls; Statistics::Scalar<> fnCalls;
Statistics::MainBin *Kernel; Statistics::MainBin *Kernel;
Statistics::MainBin *User; Statistics::MainBin *User;
Statistics::MainBin * getBin(const std::string &name); Statistics::MainBin * getBin(const std::string &name);
virtual bool findCaller(std::string, std::string) const = 0; bool findCaller(std::string, std::string) const;
SWContext *findContext(Addr pcb); SWContext *findContext(Addr pcb);
bool addContext(Addr pcb, SWContext *ctx) { bool addContext(Addr pcb, SWContext *ctx) {
@ -68,18 +72,23 @@ class System : public SimObject
swCtxMap.erase(pcb); swCtxMap.erase(pcb);
return; return;
} }
void dumpState(ExecContext *xc) const;
virtual void dumpState(ExecContext *xc) const = 0;
virtual void serialize(std::ostream &os); virtual void serialize(std::ostream &os);
virtual void unserialize(Checkpoint *cp, const std::string &section); virtual void unserialize(Checkpoint *cp, const std::string &section);
//
private:
std::multimap<const std::string, std::string> callerMap;
void populateMap(std::string caller, std::string callee);
//
public: public:
const uint64_t init_param; const uint64_t init_param;
MemoryController *memCtrl; MemoryController *memCtrl;
PhysicalMemory *physmem; PhysicalMemory *physmem;
bool bin; bool bin;
std::vector<string> binned_fns;
PCEventQueue pcEventQueue; PCEventQueue pcEventQueue;
@ -90,7 +99,8 @@ class System : public SimObject
public: public:
System(const std::string _name, const uint64_t _init_param, System(const std::string _name, const uint64_t _init_param,
MemoryController *, PhysicalMemory *, const bool); MemoryController *, PhysicalMemory *, const bool,
const std::vector<string> &binned_fns);
~System(); ~System();
virtual Addr getKernelStart() const = 0; virtual Addr getKernelStart() const = 0;