#include "cpu/thread_context.hh"
#include "cpu/profile.hh"
#include "sim/sim_exit.hh"
-#include "sim/param.hh"
#include "sim/process.hh"
#include "sim/sim_events.hh"
#include "sim/system.hh"
{
Counter temp = cpu->totalInstructions();
#ifndef NDEBUG
- double ipc = double(temp - lastNumInst) / (interval / cpu->cycles(1));
+ double ipc = double(temp - lastNumInst) / (interval / cpu->ticks(1));
DPRINTFN("%s progress event, instructions committed: %lli, IPC: %0.8d\n",
cpu->name(), temp - lastNumInst, ipc);
const char *
CPUProgressEvent::description()
{
- return "CPU Progress event";
+ return "CPU Progress";
}
#if FULL_SYSTEM
BaseCPU::BaseCPU(Params *p)
- : MemObject(p->name), clock(p->clock), instCnt(0),
+ : MemObject(makeParams(p->name)), clock(p->clock), instCnt(0),
params(p), number_of_threads(p->numberOfThreads), system(p->system),
phase(p->phase)
#else
BaseCPU::BaseCPU(Params *p)
- : MemObject(p->name), clock(p->clock), params(p),
+ : MemObject(makeParams(p->name)), clock(p->clock), params(p),
number_of_threads(p->numberOfThreads), system(p->system),
phase(p->phase)
#endif
{
// currentTick = curTick;
- DPRINTF(FullCPU, "BaseCPU: Creating object, mem address %#x.\n", this);
// add self to global list of CPUs
cpuList.push_back(this);
- DPRINTF(FullCPU, "BaseCPU: CPU added to cpuList, mem address %#x.\n",
- this);
-
if (number_of_threads > maxThreadsPerCPU)
maxThreadsPerCPU = number_of_threads;
if (p->functionTraceStart == 0) {
functionTracingEnabled = true;
} else {
- Event *e =
- new EventWrapper<BaseCPU, &BaseCPU::enableFunctionTrace>(this,
- true);
- e->schedule(p->functionTraceStart);
+ new EventWrapper<BaseCPU, &BaseCPU::enableFunctionTrace>(this,
+ p->functionTraceStart,
+ true);
}
}
#if FULL_SYSTEM
if (params->profile)
profileEvent = new ProfileEvent(this, params->profile);
#endif
+ tracer = params->tracer;
}
BaseCPU::Params::Params()
profile = false;
#endif
checker = NULL;
+ tracer = NULL;
}
void
if (params->progress_interval) {
new CPUProgressEvent(&mainEventQueue,
- cycles(params->progress_interval),
+ ticks(params->progress_interval),
this);
}
}
BaseCPU::nextCycle(Tick begin_tick)
{
Tick next_tick = begin_tick;
- next_tick -= (next_tick % clock);
+ if (next_tick % clock != 0)
+ next_tick = next_tick - (next_tick % clock) + clock;
next_tick += phase;
- while (next_tick < curTick)
- next_tick += clock;
-
assert(next_tick >= curTick);
return next_tick;
}
for (int i = 0; i < threadContexts.size(); ++i)
threadContexts[i]->profileClear();
- // The Sampler must take care of this!
-// if (profileEvent)
-// profileEvent->schedule(curTick);
+ if (profileEvent)
+ profileEvent->schedule(curTick);
#endif
// Connect new CPU to old CPU's memory only if new CPU isn't
functionEntryTick = curTick;
}
}
-
-
-DEFINE_SIM_OBJECT_CLASS_NAME("BaseCPU", BaseCPU)