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:
parent
31f82cef41
commit
ee96799519
7 changed files with 38 additions and 80 deletions
|
@ -2498,7 +2498,7 @@ struct NoBin
|
||||||
* binned. If the typedef is NoBin, nothing is binned. If it is
|
* binned. If the typedef is NoBin, nothing is binned. If it is
|
||||||
* MainBin, then all stats are binned under that Bin.
|
* MainBin, then all stats are binned under that Bin.
|
||||||
*/
|
*/
|
||||||
#ifdef FS_MEASURE
|
#if defined(STATS_BINNING)
|
||||||
typedef MainBin DefaultBin;
|
typedef MainBin DefaultBin;
|
||||||
#else
|
#else
|
||||||
typedef NoBin DefaultBin;
|
typedef NoBin DefaultBin;
|
||||||
|
|
|
@ -48,10 +48,7 @@ ExecContext::ExecContext(BaseCPU *_cpu, int _thread_num, System *_sys,
|
||||||
kernelStats(this, _cpu), cpu(_cpu), thread_num(_thread_num),
|
kernelStats(this, _cpu), cpu(_cpu), thread_num(_thread_num),
|
||||||
cpu_id(-1), mem(_mem), itb(_itb), dtb(_dtb), system(_sys),
|
cpu_id(-1), mem(_mem), itb(_itb), dtb(_dtb), system(_sys),
|
||||||
memCtrl(_sys->memCtrl), physmem(_sys->physmem),
|
memCtrl(_sys->memCtrl), physmem(_sys->physmem),
|
||||||
#ifdef FS_MEASURE
|
swCtx(NULL), func_exe_inst(0), storeCondFailures(0)
|
||||||
swCtx(NULL),
|
|
||||||
#endif
|
|
||||||
func_exe_inst(0), storeCondFailures(0)
|
|
||||||
{
|
{
|
||||||
memset(®s, 0, sizeof(RegFile));
|
memset(®s, 0, sizeof(RegFile));
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,10 +45,7 @@ class MemoryController;
|
||||||
|
|
||||||
#include "kern/tru64/kernel_stats.hh"
|
#include "kern/tru64/kernel_stats.hh"
|
||||||
#include "sim/system.hh"
|
#include "sim/system.hh"
|
||||||
|
|
||||||
#ifdef FS_MEASURE
|
|
||||||
#include "sim/sw_context.hh"
|
#include "sim/sw_context.hh"
|
||||||
#endif
|
|
||||||
|
|
||||||
#else // !FULL_SYSTEM
|
#else // !FULL_SYSTEM
|
||||||
|
|
||||||
|
@ -137,10 +134,7 @@ class ExecContext
|
||||||
MemoryController *memCtrl;
|
MemoryController *memCtrl;
|
||||||
PhysicalMemory *physmem;
|
PhysicalMemory *physmem;
|
||||||
|
|
||||||
#ifdef FS_MEASURE
|
|
||||||
SWContext *swCtx;
|
SWContext *swCtx;
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
Process *process;
|
Process *process;
|
||||||
|
|
||||||
|
|
|
@ -675,32 +675,13 @@ SimpleCPU::tick()
|
||||||
xc->func_exe_inst++;
|
xc->func_exe_inst++;
|
||||||
|
|
||||||
fault = si->execute(this, xc, traceData);
|
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);
|
#ifdef FULL_SYSTEM
|
||||||
} else {
|
SWContext *ctx = xc->swCtx;
|
||||||
ctx->calls--;
|
if (ctx)
|
||||||
}
|
ctx->process(xc, si.get());
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (si->isMemRef()) {
|
if (si->isMemRef()) {
|
||||||
numMemRefs++;
|
numMemRefs++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -604,7 +604,6 @@ Tru64System::breakpoint()
|
||||||
return remoteGDB[0]->trap(ALPHA_KENTRY_INT);
|
return remoteGDB[0]->trap(ALPHA_KENTRY_INT);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FS_MEASURE
|
|
||||||
void
|
void
|
||||||
Tru64System::populateMap(std::string callee, std::string caller)
|
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)
|
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(console_code, "file that contains the console code"),
|
||||||
INIT_PARAM(pal_code, "file that contains palcode"),
|
INIT_PARAM(pal_code, "file that contains palcode"),
|
||||||
INIT_PARAM_DFLT(boot_osflags, "flags to pass to the kernel during boot",
|
INIT_PARAM_DFLT(boot_osflags, "flags to pass to the kernel during boot",
|
||||||
"a")
|
"a")
|
||||||
|
|
||||||
|
|
||||||
END_INIT_SIM_OBJECT_PARAMS(Tru64System)
|
END_INIT_SIM_OBJECT_PARAMS(Tru64System)
|
||||||
|
|
|
@ -29,15 +29,12 @@
|
||||||
#ifndef __TRU64_SYSTEM_HH__
|
#ifndef __TRU64_SYSTEM_HH__
|
||||||
#define __TRU64_SYSTEM_HH__
|
#define __TRU64_SYSTEM_HH__
|
||||||
|
|
||||||
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "sim/system.hh"
|
#include "sim/system.hh"
|
||||||
#include "targetarch/isa_traits.hh"
|
#include "targetarch/isa_traits.hh"
|
||||||
|
|
||||||
#ifdef FS_MEASURE
|
|
||||||
#include <map>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class ExecContext;
|
class ExecContext;
|
||||||
class EcoffObject;
|
class EcoffObject;
|
||||||
class SymbolTable;
|
class SymbolTable;
|
||||||
|
@ -48,9 +45,7 @@ class SkipFuncEvent;
|
||||||
class PrintfEvent;
|
class PrintfEvent;
|
||||||
class DebugPrintfEvent;
|
class DebugPrintfEvent;
|
||||||
class DumpMbufEvent;
|
class DumpMbufEvent;
|
||||||
#ifdef FS_MEASURE
|
|
||||||
class FnEvent;
|
class FnEvent;
|
||||||
#endif
|
|
||||||
class AlphaArguments;
|
class AlphaArguments;
|
||||||
|
|
||||||
class Tru64System : public System
|
class Tru64System : public System
|
||||||
|
@ -150,11 +145,6 @@ class Tru64System : public System
|
||||||
Addr kernelEntry;
|
Addr kernelEntry;
|
||||||
bool bin;
|
bool bin;
|
||||||
|
|
||||||
#ifdef FS_MEASURE
|
|
||||||
std::multimap<const std::string, std::string> callerMap;
|
|
||||||
void populateMap(std::string caller, std::string callee);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::vector<RemoteGDB *> remoteGDB;
|
std::vector<RemoteGDB *> remoteGDB;
|
||||||
std::vector<GDBListener *> gdbListen;
|
std::vector<GDBListener *> gdbListen;
|
||||||
|
@ -168,7 +158,7 @@ class Tru64System : public System
|
||||||
const std::string &console_path,
|
const std::string &console_path,
|
||||||
const std::string &palcode,
|
const std::string &palcode,
|
||||||
const std::string &boot_osflags,
|
const std::string &boot_osflags,
|
||||||
const bool _bin);
|
const bool _bin);
|
||||||
~Tru64System();
|
~Tru64System();
|
||||||
|
|
||||||
int registerExecContext(ExecContext *xc);
|
int registerExecContext(ExecContext *xc);
|
||||||
|
@ -182,10 +172,15 @@ class Tru64System : public System
|
||||||
static void Printf(AlphaArguments args);
|
static void Printf(AlphaArguments args);
|
||||||
static void DumpMbuf(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;
|
bool findCaller(std::string callee, std::string caller) const;
|
||||||
void dumpState(ExecContext *xc) const;
|
void dumpState(ExecContext *xc) const;
|
||||||
#endif //FS_MEASURE
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __TRU64_SYSTEM_HH__
|
#endif // __TRU64_SYSTEM_HH__
|
||||||
|
|
|
@ -32,14 +32,11 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "sim/sim_object.hh"
|
|
||||||
#include "cpu/pc_event.hh"
|
|
||||||
#include "base/loader/symtab.hh"
|
#include "base/loader/symtab.hh"
|
||||||
|
|
||||||
#ifdef FS_MEASURE
|
|
||||||
#include "base/statistics.hh"
|
#include "base/statistics.hh"
|
||||||
|
#include "cpu/pc_event.hh"
|
||||||
|
#include "sim/sim_object.hh"
|
||||||
#include "sim/sw_context.hh"
|
#include "sim/sw_context.hh"
|
||||||
#endif
|
|
||||||
|
|
||||||
class MemoryController;
|
class MemoryController;
|
||||||
class PhysicalMemory;
|
class PhysicalMemory;
|
||||||
|
@ -50,11 +47,28 @@ class ExecContext;
|
||||||
|
|
||||||
class System : public SimObject
|
class System : public SimObject
|
||||||
{
|
{
|
||||||
#ifdef FS_MEASURE
|
// lisa's binning stuff
|
||||||
protected:
|
protected:
|
||||||
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;
|
||||||
#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:
|
public:
|
||||||
const uint64_t init_param;
|
const uint64_t init_param;
|
||||||
|
@ -69,11 +83,6 @@ class System : public SimObject
|
||||||
virtual int registerExecContext(ExecContext *xc);
|
virtual int registerExecContext(ExecContext *xc);
|
||||||
virtual void replaceExecContext(int xcIndex, 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:
|
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);
|
||||||
|
@ -84,22 +93,6 @@ class System : public SimObject
|
||||||
virtual Addr getKernelEntry() const = 0;
|
virtual Addr getKernelEntry() const = 0;
|
||||||
virtual bool breakpoint() = 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:
|
public:
|
||||||
////////////////////////////////////////////
|
////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue