From: Nathan Binkert Date: Mon, 1 Mar 2004 01:22:32 +0000 (-0500) Subject: Initial cleanup pass of lisa's function call tracking X-Git-Tag: m5_1.0_beta2~112^2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ee967995196739b90c0b1c384d7e245d1dffdc80;p=gem5.git Initial cleanup pass of lisa's function call tracking code. base/statistics.hh: We're getting rid of FS_MEASURE, but for now, we're going to still use a compile time flag to turn on and off binning of statistics. (The flag is STATS_BINNING) cpu/exec_context.cc: cpu/exec_context.hh: kern/tru64/tru64_system.cc: get rid of FS_MEASURE cpu/simple_cpu/simple_cpu.cc: yank the function call tracking code out of the cpu and move it into the software context class itself. kern/tru64/tru64_system.hh: get rid of FS_MEASURE move all of the tacking stuff to the same place. sim/system.hh: cleanup --HG-- extra : convert_revision : 73d3843afe1b3ba0d5445421c39c1148d3f4e7c0 --- diff --git a/base/statistics.hh b/base/statistics.hh index 71d2aa8c8..c99aadab5 100644 --- a/base/statistics.hh +++ b/base/statistics.hh @@ -2498,7 +2498,7 @@ struct NoBin * binned. If the typedef is NoBin, nothing is binned. If it is * MainBin, then all stats are binned under that Bin. */ -#ifdef FS_MEASURE +#if defined(STATS_BINNING) typedef MainBin DefaultBin; #else typedef NoBin DefaultBin; diff --git a/cpu/exec_context.cc b/cpu/exec_context.cc index 6a5f463cd..b0ebb9622 100644 --- a/cpu/exec_context.cc +++ b/cpu/exec_context.cc @@ -48,10 +48,7 @@ ExecContext::ExecContext(BaseCPU *_cpu, int _thread_num, System *_sys, kernelStats(this, _cpu), cpu(_cpu), thread_num(_thread_num), cpu_id(-1), mem(_mem), itb(_itb), dtb(_dtb), system(_sys), memCtrl(_sys->memCtrl), physmem(_sys->physmem), -#ifdef FS_MEASURE - swCtx(NULL), -#endif - func_exe_inst(0), storeCondFailures(0) + swCtx(NULL), func_exe_inst(0), storeCondFailures(0) { memset(®s, 0, sizeof(RegFile)); } diff --git a/cpu/exec_context.hh b/cpu/exec_context.hh index e9dc5efec..a4bbdd484 100644 --- a/cpu/exec_context.hh +++ b/cpu/exec_context.hh @@ -45,10 +45,7 @@ class MemoryController; #include "kern/tru64/kernel_stats.hh" #include "sim/system.hh" - -#ifdef FS_MEASURE #include "sim/sw_context.hh" -#endif #else // !FULL_SYSTEM @@ -137,10 +134,7 @@ class ExecContext MemoryController *memCtrl; PhysicalMemory *physmem; -#ifdef FS_MEASURE SWContext *swCtx; -#endif - #else Process *process; diff --git a/cpu/simple_cpu/simple_cpu.cc b/cpu/simple_cpu/simple_cpu.cc index 721861dd5..c25a95775 100644 --- a/cpu/simple_cpu/simple_cpu.cc +++ b/cpu/simple_cpu/simple_cpu.cc @@ -675,32 +675,13 @@ SimpleCPU::tick() xc->func_exe_inst++; fault = si->execute(this, xc, traceData); -#ifdef FS_MEASURE - if (!(xc->misspeculating()) && (xc->system->bin)) { - SWContext *ctx = xc->swCtx; - if (ctx && !ctx->callStack.empty()) { - if (si->isCall()) { - ctx->calls++; - } - if (si->isReturn()) { - if (ctx->calls == 0) { - fnCall *top = ctx->callStack.top(); - DPRINTF(TCPIP, "Removing %s from callstack.\n", top->name); - delete top; - ctx->callStack.pop(); - if (ctx->callStack.empty()) - xc->system->nonPath->activate(); - else - ctx->callStack.top()->myBin->activate(); - - xc->system->dumpState(xc); - } else { - ctx->calls--; - } - } - } - } + +#ifdef FULL_SYSTEM + SWContext *ctx = xc->swCtx; + if (ctx) + ctx->process(xc, si.get()); #endif + if (si->isMemRef()) { numMemRefs++; } diff --git a/kern/tru64/tru64_system.cc b/kern/tru64/tru64_system.cc index 1cd98fdc1..13f28beab 100644 --- a/kern/tru64/tru64_system.cc +++ b/kern/tru64/tru64_system.cc @@ -604,7 +604,6 @@ Tru64System::breakpoint() return remoteGDB[0]->trap(ALPHA_KENTRY_INT); } -#ifdef FS_MEASURE void Tru64System::populateMap(std::string callee, std::string caller) { @@ -646,7 +645,6 @@ Tru64System::dumpState(ExecContext *xc) const } } } -#endif //FS_MEASURE BEGIN_DECLARE_SIM_OBJECT_PARAMS(Tru64System) @@ -672,7 +670,7 @@ BEGIN_INIT_SIM_OBJECT_PARAMS(Tru64System) INIT_PARAM(console_code, "file that contains the console code"), INIT_PARAM(pal_code, "file that contains palcode"), INIT_PARAM_DFLT(boot_osflags, "flags to pass to the kernel during boot", - "a") + "a") END_INIT_SIM_OBJECT_PARAMS(Tru64System) diff --git a/kern/tru64/tru64_system.hh b/kern/tru64/tru64_system.hh index 93cc908e3..bedf1f383 100644 --- a/kern/tru64/tru64_system.hh +++ b/kern/tru64/tru64_system.hh @@ -29,15 +29,12 @@ #ifndef __TRU64_SYSTEM_HH__ #define __TRU64_SYSTEM_HH__ +#include #include #include "sim/system.hh" #include "targetarch/isa_traits.hh" -#ifdef FS_MEASURE -#include -#endif - class ExecContext; class EcoffObject; class SymbolTable; @@ -48,9 +45,7 @@ class SkipFuncEvent; class PrintfEvent; class DebugPrintfEvent; class DumpMbufEvent; -#ifdef FS_MEASURE class FnEvent; -#endif class AlphaArguments; class Tru64System : public System @@ -150,11 +145,6 @@ class Tru64System : public System Addr kernelEntry; bool bin; -#ifdef FS_MEASURE - std::multimap callerMap; - void populateMap(std::string caller, std::string callee); -#endif - public: std::vector remoteGDB; std::vector gdbListen; @@ -168,7 +158,7 @@ class Tru64System : public System const std::string &console_path, const std::string &palcode, const std::string &boot_osflags, - const bool _bin); + const bool _bin); ~Tru64System(); int registerExecContext(ExecContext *xc); @@ -182,10 +172,15 @@ class Tru64System : public System static void Printf(AlphaArguments args); static void DumpMbuf(AlphaArguments args); -#ifdef FS_MEASURE + + // Lisa's fs measure stuff + private: + std::multimap 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 //FS_MEASURE }; #endif // __TRU64_SYSTEM_HH__ diff --git a/sim/system.hh b/sim/system.hh index 8348a144e..2e0cb3dbf 100644 --- a/sim/system.hh +++ b/sim/system.hh @@ -32,14 +32,11 @@ #include #include -#include "sim/sim_object.hh" -#include "cpu/pc_event.hh" #include "base/loader/symtab.hh" - -#ifdef FS_MEASURE #include "base/statistics.hh" +#include "cpu/pc_event.hh" +#include "sim/sim_object.hh" #include "sim/sw_context.hh" -#endif class MemoryController; class PhysicalMemory; @@ -50,11 +47,28 @@ class ExecContext; class System : public SimObject { -#ifdef FS_MEASURE + // lisa's binning stuff protected: std::map fnBins; std::map swCtxMap; -#endif //FS_MEASURE + + public: + Statistics::Scalar fnCalls; + Statistics::MainBin *nonPath; + + Statistics::MainBin * 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; public: const uint64_t init_param; @@ -69,11 +83,6 @@ class System : public SimObject virtual int registerExecContext(ExecContext *xc); virtual void replaceExecContext(int xcIndex, ExecContext *xc); -#ifdef FS_MEASURE - Statistics::Scalar fnCalls; - Statistics::MainBin *nonPath; -#endif //FS_MEASURE - public: System(const std::string _name, const uint64_t _init_param, MemoryController *, PhysicalMemory *, const bool); @@ -84,22 +93,6 @@ class System : public SimObject virtual Addr getKernelEntry() const = 0; virtual bool breakpoint() = 0; -#ifdef FS_MEASURE - Statistics::MainBin * 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: //////////////////////////////////////////// //