summaryrefslogtreecommitdiff
path: root/cpu
diff options
context:
space:
mode:
Diffstat (limited to 'cpu')
-rw-r--r--cpu/base.cc13
-rw-r--r--cpu/cpu_exec_context.cc15
-rw-r--r--cpu/cpu_exec_context.hh4
-rw-r--r--cpu/exec_context.hh7
4 files changed, 32 insertions, 7 deletions
diff --git a/cpu/base.cc b/cpu/base.cc
index e2a4c214a..2eb5f7fd3 100644
--- a/cpu/base.cc
+++ b/cpu/base.cc
@@ -271,11 +271,10 @@ BaseCPU::takeOverFrom(BaseCPU *oldCPU)
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
@@ -290,11 +289,11 @@ BaseCPU::ProfileEvent::ProfileEvent(BaseCPU *_cpu, int _interval)
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);
}
diff --git a/cpu/cpu_exec_context.cc b/cpu/cpu_exec_context.cc
index 74b609764..683d07787 100644
--- a/cpu/cpu_exec_context.cc
+++ b/cpu/cpu_exec_context.cc
@@ -137,6 +137,21 @@ CPUExecContext::EndQuiesceEvent::description()
{
return "End Quiesce Event.";
}
+
+void
+CPUExecContext::profileClear()
+{
+ if (profile)
+ profile->clear();
+}
+
+void
+CPUExecContext::profileSample()
+{
+ if (profile)
+ profile->sample(profileNode, profilePC);
+}
+
#endif
void
diff --git a/cpu/cpu_exec_context.hh b/cpu/cpu_exec_context.hh
index f5c57da22..e2fbb2368 100644
--- a/cpu/cpu_exec_context.hh
+++ b/cpu/cpu_exec_context.hh
@@ -157,6 +157,10 @@ class CPUExecContext
Tick readLastSuspend() { return lastSuspend; }
+ void profileClear();
+
+ void profileSample();
+
#else
Process *process;
diff --git a/cpu/exec_context.hh b/cpu/exec_context.hh
index b7653f121..2b6c41bd7 100644
--- a/cpu/exec_context.hh
+++ b/cpu/exec_context.hh
@@ -136,6 +136,9 @@ class ExecContext
// 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;
@@ -152,6 +155,7 @@ class ExecContext
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;
@@ -294,6 +298,9 @@ class ProxyExecContext : public ExecContext
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(); }