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
This commit is contained in:
Nathan Binkert 2004-02-29 20:22:32 -05:00
parent 31f82cef41
commit ee96799519
7 changed files with 38 additions and 80 deletions

View file

@ -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;

View file

@ -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(&regs, 0, sizeof(RegFile));
}

View file

@ -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;

View file

@ -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++;
}

View file

@ -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)

View file

@ -29,15 +29,12 @@
#ifndef __TRU64_SYSTEM_HH__
#define __TRU64_SYSTEM_HH__
#include <map>
#include <vector>
#include "sim/system.hh"
#include "targetarch/isa_traits.hh"
#ifdef FS_MEASURE
#include <map>
#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<const std::string, std::string> callerMap;
void populateMap(std::string caller, std::string callee);
#endif
public:
std::vector<RemoteGDB *> remoteGDB;
std::vector<GDBListener *> 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<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 //FS_MEASURE
};
#endif // __TRU64_SYSTEM_HH__

View file

@ -32,14 +32,11 @@
#include <string>
#include <vector>
#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<const std::string, Statistics::MainBin *> fnBins;
std::map<const Addr, SWContext *> swCtxMap;
#endif //FS_MEASURE
public:
Statistics::Scalar<Counter> 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<Counter, Statistics::MainBin> 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:
////////////////////////////////////////////
//