#else // !FULL_SYSTEM
#include "eio/eio.hh"
#include "mem/functional_mem/functional_memory.hh"
-#include "sim/prog.hh"
#endif // FULL_SYSTEM
using namespace std;
SimpleCPU::TickEvent::TickEvent(SimpleCPU *c)
- : Event(&mainEventQueue, "SimpleCPU::TickEvent", 100), cpu(c)
+ : Event(&mainEventQueue, 100), cpu(c)
{
}
SimpleCPU::CacheCompletionEvent::CacheCompletionEvent(SimpleCPU *_cpu)
- : Event(&mainEventQueue, "SimpleCPU::CacheCompletionEvent"),
+ : Event(&mainEventQueue),
cpu(_cpu)
{
}
memReq->data = new uint8_t[64];
numInst = 0;
+ startNumInst = 0;
numLoad = 0;
- last_idle = 0;
+ startNumLoad = 0;
lastIcacheStall = 0;
lastDcacheStall = 0;
{
}
-
void
SimpleCPU::switchOut()
{
void
SimpleCPU::regStats()
{
+ using namespace Statistics;
+
BaseCPU::regStats();
numInsts
.desc("Number of memory references")
;
- idleCycles
- .name(name() + ".idle_cycles")
- .desc("Number of idle cycles")
- ;
-
idleFraction
.name(name() + ".idle_fraction")
.desc("Percentage of idle cycles")
.prereq(dcacheStallCycles)
;
- idleFraction = idleCycles / simTicks;
-
- numInsts = Statistics::scalar(numInst);
+ numInsts = Statistics::scalar(numInst) - Statistics::scalar(startNumInst);
simInsts += numInsts;
}
+void
+SimpleCPU::resetStats()
+{
+ startNumInst = numInst;
+}
+
void
SimpleCPU::serialize(ostream &os)
{
xc->func_exe_insn++;
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--;
+ }
+ }
+ }
+ }
+#endif
if (si->isMemRef()) {
numMemRefs++;
}