From f948f9fca987b25ef0716e87fdc4e874fb607c14 Mon Sep 17 00:00:00 2001 From: Geoffrey Blake Date: Tue, 5 Apr 2016 05:29:02 -0500 Subject: cpu: Query CPU for inst executed from Python This patch adds the ability for the simulator to query the number of instructions a CPU has executed so far per hw-thread. This can be used to enable more flexible periodic events such as taking checkpoints starting 1s into simulation and X instructions thereafter. --- src/cpu/base.hh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/cpu/base.hh') 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: /** * @{ -- cgit v1.2.3