diff options
Diffstat (limited to 'sim')
-rw-r--r-- | sim/system.cc | 38 | ||||
-rw-r--r-- | sim/system.hh | 34 |
2 files changed, 69 insertions, 3 deletions
diff --git a/sim/system.cc b/sim/system.cc index af4a4c151..58e290d1a 100644 --- a/sim/system.cc +++ b/sim/system.cc @@ -40,14 +40,23 @@ int System::numSystemsRunning = 0; System::System(const std::string _name, const uint64_t _init_param, MemoryController *_memCtrl, - PhysicalMemory *_physmem) + PhysicalMemory *_physmem, + const bool _bin) : SimObject(_name), init_param(_init_param), memCtrl(_memCtrl), - physmem(_physmem) + physmem(_physmem), + bin(_bin) { // add self to global system list systemList.push_back(this); +#ifdef FS_MEASURE + if (bin == true) { + nonPath = new Statistics::MainBin("non TCPIP path stats"); + nonPath->activate(); + } else + nonPath = NULL; +#endif } @@ -95,5 +104,30 @@ printSystems() System::printSystems(); } +#ifdef FS_MEASURE +Statistics::GenBin * +System::getBin(const std::string &name) +{ + std::map<const std::string, Statistics::GenBin *>::const_iterator i; + i = fnBins.find(name); + if (i == fnBins.end()) + panic("trying to getBin that is not on system map!"); + return (*i).second; +} + +SWContext * +System::findContext(Addr pcb) +{ + std::map<Addr, SWContext *>::const_iterator iter; + iter = swCtxMap.find(pcb); + if (iter != swCtxMap.end()) { + SWContext *ctx = (*iter).second; + assert(ctx != NULL && "should never have a null ctx in ctxMap"); + return ctx; + } else + return NULL; +} +#endif //FS_MEASURE + DEFINE_SIM_OBJECT_CLASS_NAME("System", System) diff --git a/sim/system.hh b/sim/system.hh index 081aa3eb7..741dea0db 100644 --- a/sim/system.hh +++ b/sim/system.hh @@ -36,6 +36,11 @@ #include "cpu/pc_event.hh" #include "base/loader/symtab.hh" +#ifdef FS_MEASURE +#include "base/statistics.hh" +#include "sim/sw_context.hh" +#endif + class MemoryController; class PhysicalMemory; class RemoteGDB; @@ -45,10 +50,17 @@ class ExecContext; class System : public SimObject { +#ifdef FS_MEASURE + protected: + std::map<const std::string, Statistics::GenBin *> fnBins; + std::map<const Addr, SWContext *> swCtxMap; +#endif //FS_MEASURE + public: const uint64_t init_param; MemoryController *memCtrl; PhysicalMemory *physmem; + bool bin; PCEventQueue pcEventQueue; @@ -57,9 +69,14 @@ class System : public SimObject virtual int registerExecContext(ExecContext *xc); virtual void replaceExecContext(int xcIndex, ExecContext *xc); +#ifdef FS_MEASURE + Statistics::Scalar<Counter, Statistics::MainBin> fnCalls; + Statistics::MainBin *nonPath; +#endif //FS_MEASURE + public: System(const std::string _name, const uint64_t _init_param, - MemoryController *, PhysicalMemory *); + MemoryController *, PhysicalMemory *, const bool); ~System(); virtual Addr getKernelStart() const = 0; @@ -67,6 +84,21 @@ class System : public SimObject virtual Addr getKernelEntry() const = 0; virtual bool breakpoint() = 0; +#ifdef FS_MEASURE + Statistics::GenBin * getBin(const std::string &name); + virtual bool findCaller(std::string, std::string) const = 0; + + SWContext *findContext(Addr pcb); + bool addContext(Addr pcb, SWContext *ctx) { + return (swCtxMap.insert(make_pair(pcb, ctx))).second; + } + void remContext(Addr pcb) { + swCtxMap.erase(pcb); + return; + } + + virtual void dumpState(ExecContext *xc) const = 0; +#endif //FS_MEASURE public: //////////////////////////////////////////// |