From 1a27580e3bb113a0eca64a5075a00e45cc9cdd0d Mon Sep 17 00:00:00 2001 From: Javier Bueno Date: Tue, 26 Mar 2019 23:12:00 +0100 Subject: cpu: Added a probe to notify the address of retired instructions 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 Reviewed-by: Andreas Sandberg Maintainer: Andreas Sandberg --- src/cpu/base.cc | 8 +++++--- src/cpu/base.hh | 4 +++- src/cpu/minor/execute.cc | 2 +- src/cpu/o3/cpu.cc | 2 +- src/cpu/simple/base.cc | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) (limited to 'src/cpu') diff --git a/src/cpu/base.cc b/src/cpu/base.cc index 8dfcf3cda..8e49fb103 100644 --- a/src/cpu/base.cc +++ b/src/cpu/base.cc @@ -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); diff --git a/src/cpu/base.hh b/src/cpu/base.hh index 9075d4b33..f9b24b923 100644 --- a/src/cpu/base.hh +++ b/src/cpu/base.hh @@ -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; diff --git a/src/cpu/minor/execute.cc b/src/cpu/minor/execute.cc index 6a418202f..47f3cbc68 100644 --- a/src/cpu/minor/execute.cc +++ b/src/cpu/minor/execute.cc @@ -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 diff --git a/src/cpu/o3/cpu.cc b/src/cpu/o3/cpu.cc index 965ab04e0..9da5b4359 100644 --- a/src/cpu/o3/cpu.cc +++ b/src/cpu/o3/cpu.cc @@ -1623,7 +1623,7 @@ FullO3CPU::instDone(ThreadID tid, const DynInstPtr &inst) thread[tid]->numOps++; committedOps[tid]++; - probeInstCommit(inst->staticInst); + probeInstCommit(inst->staticInst, inst->instAddr()); } template diff --git a/src/cpu/simple/base.cc b/src/cpu/simple/base.cc index 422c73298..b243dcca3 100644 --- a/src/cpu/simple/base.cc +++ b/src/cpu/simple/base.cc @@ -661,7 +661,7 @@ BaseSimpleCPU::postExecute() } // Call CPU instruction commit probes - probeInstCommit(curStaticInst); + probeInstCommit(curStaticInst, instAddr); } void -- cgit v1.2.3