cpu/base.cc:
Change to be calls through the ExecContext instead of accessing the profile object directly.
cpu/cpu_exec_context.cc:
Add functions to clear and sample the profile object.
cpu/cpu_exec_context.hh:
Add functions to clear and sample the profile object. These are not the most flexible functions; it might be better to eventually move the quiesce, profile, and store conditional stuff out of ExecContext so they don't clutter the interface.
cpu/exec_context.hh:
Include functions to support using the profile object to clear itself and take samples.
--HG--
extra : convert_revision :
40849915fd51303673451515debb9ecdc7afb8c8
for (int i = 0; i < TheISA::NumInterruptLevels; ++i)
interrupts[i] = oldCPU->interrupts[i];
intstatus = oldCPU->intstatus;
-/*
+
for (int i = 0; i < execContexts.size(); ++i)
- if (execContexts[i]->profile)
- execContexts[i]->profile->clear();
-*/
+ execContexts[i]->profileClear();
+
if (profileEvent)
profileEvent->schedule(curTick);
#endif
void
BaseCPU::ProfileEvent::process()
{
-/* for (int i = 0, size = cpu->execContexts.size(); i < size; ++i) {
+ for (int i = 0, size = cpu->execContexts.size(); i < size; ++i) {
ExecContext *xc = cpu->execContexts[i];
- xc->profile->sample(xc->profileNode, xc->profilePC);
+ xc->profileSample();
}
-*/
+
schedule(curTick + interval);
}
{
return "End Quiesce Event.";
}
+
+void
+CPUExecContext::profileClear()
+{
+ if (profile)
+ profile->clear();
+}
+
+void
+CPUExecContext::profileSample()
+{
+ if (profile)
+ profile->sample(profileNode, profilePC);
+}
+
#endif
void
Tick readLastSuspend() { return lastSuspend; }
+ void profileClear();
+
+ void profileSample();
+
#else
Process *process;
// Having an extra function just to read these is obnoxious
virtual Tick readLastActivate() = 0;
virtual Tick readLastSuspend() = 0;
+
+ virtual void profileClear() = 0;
+ virtual void profileSample() = 0;
#endif
virtual int getThreadNum() = 0;
virtual Fault translateDataWriteReq(MemReqPtr &req) = 0;
// Also somewhat obnoxious. Really only used for the TLB fault.
+ // However, may be quite useful in SPARC.
virtual TheISA::MachInst getInst() = 0;
virtual void copyArchRegs(ExecContext *xc) = 0;
Tick readLastActivate() { return actualXC->readLastActivate(); }
Tick readLastSuspend() { return actualXC->readLastSuspend(); }
+
+ void profileClear() { return actualXC->profileClear(); }
+ void profileSample() { return actualXC->profileSample(); }
#endif
int getThreadNum() { return actualXC->getThreadNum(); }