summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cpu/BaseCPU.py1
-rw-r--r--src/cpu/base.cc6
-rw-r--r--src/cpu/base.hh9
3 files changed, 16 insertions, 0 deletions
diff --git a/src/cpu/BaseCPU.py b/src/cpu/BaseCPU.py
index a54a63b46..4d114cbdc 100644
--- a/src/cpu/BaseCPU.py
+++ b/src/cpu/BaseCPU.py
@@ -101,6 +101,7 @@ class BaseCPU(MemObject):
Counter totalInsts();
void scheduleInstStop(ThreadID tid, Counter insts, const char *cause);
void scheduleLoadStop(ThreadID tid, Counter loads, const char *cause);
+ uint64_t getCurrentInstCount(ThreadID tid);
''')
@classmethod
diff --git a/src/cpu/base.cc b/src/cpu/base.cc
index 22fca4dc5..624843f42 100644
--- a/src/cpu/base.cc
+++ b/src/cpu/base.cc
@@ -691,6 +691,12 @@ BaseCPU::scheduleInstStop(ThreadID tid, Counter insts, const char *cause)
comInstEventQueue[tid]->schedule(event, now + insts);
}
+uint64_t
+BaseCPU::getCurrentInstCount(ThreadID tid)
+{
+ return Tick(comInstEventQueue[tid]->getCurTick());
+}
+
AddressMonitor::AddressMonitor() {
armed = false;
waiting = false;
diff --git a/src/cpu/base.hh b/src/cpu/base.hh
index 87f27acca..438c38812 100644
--- a/src/cpu/base.hh
+++ b/src/cpu/base.hh
@@ -465,6 +465,15 @@ class BaseCPU : public MemObject
*/
void scheduleLoadStop(ThreadID tid, Counter loads, const char *cause);
+ /**
+ * Get the number of instructions executed by the specified thread
+ * on this CPU. Used by Python to control simulation.
+ *
+ * @param tid Thread monitor
+ * @return Number of instructions executed
+ */
+ uint64_t getCurrentInstCount(ThreadID tid);
+
public:
/**
* @{