cpu: Added a probe to notify the address of retired instructions
authorJavier Bueno <javier.bueno@metempsy.com>
Tue, 26 Mar 2019 22:12:00 +0000 (23:12 +0100)
committerJavier Bueno Hedo <javier.bueno@metempsy.com>
Thu, 28 Mar 2019 20:57:22 +0000 (20:57 +0000)
A probe is added to notify the address of each retired instruction.

Change-Id: Iefc1b09d74b3aa0aa5773b17ba637bf51f5a59c9
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17632
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

src/cpu/base.cc
src/cpu/base.hh
src/cpu/minor/execute.cc
src/cpu/o3/cpu.cc
src/cpu/simple/base.cc

index 8dfcf3cda5e5291be214d47e9a1c3e3292be7085..8e49fb1036bec3ebba0ede3b45c82d5f5a6ff31b 100644 (file)
@@ -391,6 +391,7 @@ BaseCPU::regProbePoints()
     ppActiveCycles = pmuProbePoint("ActiveCycles");
 
     ppRetiredInsts = pmuProbePoint("RetiredInsts");
+    ppRetiredInstsPC = pmuProbePoint("RetiredInstsPC");
     ppRetiredLoads = pmuProbePoint("RetiredLoads");
     ppRetiredStores = pmuProbePoint("RetiredStores");
     ppRetiredBranches = pmuProbePoint("RetiredBranches");
@@ -400,11 +401,12 @@ BaseCPU::regProbePoints()
 }
 
 void
-BaseCPU::probeInstCommit(const StaticInstPtr &inst)
+BaseCPU::probeInstCommit(const StaticInstPtr &inst, Addr pc)
 {
-    if (!inst->isMicroop() || inst->isLastMicroop())
+    if (!inst->isMicroop() || inst->isLastMicroop()) {
         ppRetiredInsts->notify(1);
-
+        ppRetiredInstsPC->notify(pc);
+    }
 
     if (inst->isLoad())
         ppRetiredLoads->notify(1);
index 9075d4b337e8cd9deadf41bac94f55f4249f4e14..f9b24b923748bc1a723573dee12e633b533c0f40 100644 (file)
@@ -487,8 +487,9 @@ class BaseCPU : public MemObject
      * instruction.
      *
      * @param inst Instruction that just committed
+     * @param pc PC of the instruction that just committed
      */
-    virtual void probeInstCommit(const StaticInstPtr &inst);
+    virtual void probeInstCommit(const StaticInstPtr &inst, Addr pc);
 
    protected:
     /**
@@ -509,6 +510,7 @@ class BaseCPU : public MemObject
      * instructions may call notify once for the entire bundle.
      */
     ProbePoints::PMUUPtr ppRetiredInsts;
+    ProbePoints::PMUUPtr ppRetiredInstsPC;
 
     /** Retired load instructions */
     ProbePoints::PMUUPtr ppRetiredLoads;
index 6a418202f31bd0092ffde4229340189ee7fc5eea..47f3cbc684cc8a6cc369abaf3b90253ceae22c9b 100644 (file)
@@ -872,7 +872,7 @@ Execute::doInstCommitAccounting(MinorDynInstPtr inst)
     if (inst->traceData)
         inst->traceData->setCPSeq(thread->numOp);
 
-    cpu.probeInstCommit(inst->staticInst);
+    cpu.probeInstCommit(inst->staticInst, inst->pc.instAddr());
 }
 
 bool
index 965ab04e0fdf06b322a123acdfc5b0a7c20aea7a..9da5b43593503798c3035edc47b69cd65e2d40f9 100644 (file)
@@ -1623,7 +1623,7 @@ FullO3CPU<Impl>::instDone(ThreadID tid, const DynInstPtr &inst)
     thread[tid]->numOps++;
     committedOps[tid]++;
 
-    probeInstCommit(inst->staticInst);
+    probeInstCommit(inst->staticInst, inst->instAddr());
 }
 
 template <class Impl>
index 422c732985bb250d443cb416bba56c4fdbd1e505..b243dcca30bb94de39cc0dd970bf7a59cd22db12 100644 (file)
@@ -661,7 +661,7 @@ BaseSimpleCPU::postExecute()
     }
 
     // Call CPU instruction commit probes
-    probeInstCommit(curStaticInst);
+    probeInstCommit(curStaticInst, instAddr);
 }
 
 void