This patch adds probe points in Fetch, IEW, Rename and Commit stages as follows.
A probe point is added in the Fetch stage for probing when a fetch request is
sent. Notify is fired on the probe point when a request is sent succesfully in
the first attempt as well as on a retry attempt.
Probe points are added in the IEW stage when an instruction begins to execute
and when execution is complete. This points can be used for monitoring the
execution time of an instruction.
Probe points are added in the Rename stage to probe renaming of source and
destination registers and when there is squashing. These probe points can be
used to track register dependencies and remove when there is squashing.
A probe point for squashing is added in Commit to probe squashed instructions.
/** Probe Points. */
ProbePointArg<DynInstPtr> *ppCommit;
ProbePointArg<DynInstPtr> *ppCommitStall;
+ /** To probe when an instruction is squashed */
+ ProbePointArg<DynInstPtr> *ppSquash;
public:
/** Construct a DefaultCommit with the given parameters. */
{
ppCommit = new ProbePointArg<DynInstPtr>(cpu->getProbeManager(), "Commit");
ppCommitStall = new ProbePointArg<DynInstPtr>(cpu->getProbeManager(), "CommitStall");
+ ppSquash = new ProbePointArg<DynInstPtr>(cpu->getProbeManager(), "Squash");
}
template <class Impl>
rob->retireHead(commit_thread);
++commitSquashedInsts;
+ // Notify potential listeners that this instruction is squashed
+ ppSquash->notify(head_inst);
// Record that the number of ROB entries has changed.
changedROBNumEntries[tid] = true;
ppDataAccessComplete = new ProbePointArg<std::pair<DynInstPtr, PacketPtr> >(getProbeManager(), "DataAccessComplete");
fetch.regProbePoints();
+ rename.regProbePoints();
iew.regProbePoints();
commit.regProbePoints();
}
/** Probe points. */
ProbePointArg<DynInstPtr> *ppFetch;
+ /** To probe when a fetch request is successfully sent. */
+ ProbePointArg<RequestPtr> *ppFetchRequestSent;
public:
/** DefaultFetch constructor. */
DefaultFetch<Impl>::regProbePoints()
{
ppFetch = new ProbePointArg<DynInstPtr>(cpu->getProbeManager(), "Fetch");
+ ppFetchRequestSent = new ProbePointArg<RequestPtr>(cpu->getProbeManager(),
+ "FetchRequest");
+
}
template <class Impl>
"response.\n", tid);
lastIcacheStall[tid] = curTick();
fetchStatus[tid] = IcacheWaitResponse;
+ // Notify Fetch Request probe when a packet containing a fetch
+ // request is successfully sent
+ ppFetchRequestSent->notify(mem_req);
}
} else {
// Don't send an instruction to decode if we can't handle it.
if (cpu->getInstPort().sendTimingReq(retryPkt)) {
fetchStatus[retryTid] = IcacheWaitResponse;
+ // Notify Fetch Request probe when a retryPkt is successfully sent.
+ // Note that notify must be called before retryPkt is set to NULL.
+ ppFetchRequestSent->notify(retryPkt->req);
retryPkt = NULL;
retryTid = InvalidThreadID;
cacheBlocked = false;
/** Probe points. */
ProbePointArg<DynInstPtr> *ppMispredict;
ProbePointArg<DynInstPtr> *ppDispatch;
+ /** To probe when instruction execution begins. */
+ ProbePointArg<DynInstPtr> *ppExecute;
+ /** To probe when instruction execution is complete. */
+ ProbePointArg<DynInstPtr> *ppToCommit;
public:
/** Constructs a DefaultIEW with the given parameters. */
{
ppDispatch = new ProbePointArg<DynInstPtr>(cpu->getProbeManager(), "Dispatch");
ppMispredict = new ProbePointArg<DynInstPtr>(cpu->getProbeManager(), "Mispredict");
+ /**
+ * Probe point with dynamic instruction as the argument used to probe when
+ * an instruction starts to execute.
+ */
+ ppExecute = new ProbePointArg<DynInstPtr>(cpu->getProbeManager(),
+ "Execute");
+ /**
+ * Probe point with dynamic instruction as the argument used to probe when
+ * an instruction execution completes and it is marked ready to commit.
+ */
+ ppToCommit = new ProbePointArg<DynInstPtr>(cpu->getProbeManager(),
+ "ToCommit");
}
template <class Impl>
DPRINTF(IEW, "Execute: Processing PC %s, [tid:%i] [sn:%i].\n",
inst->pcState(), inst->threadNumber,inst->seqNum);
+ // Notify potential listeners that this instruction has started
+ // executing
+ ppExecute->notify(inst);
+
// Check if the instruction is squashed; if so then skip it
if (inst->isSquashed()) {
DPRINTF(IEW, "Execute: Instruction was squashed. PC: %s, [tid:%i]"
inst->seqNum, inst->pcState());
iewInstsToCommit[tid]++;
+ // Notify potential listeners that execution is complete for this
+ // instruction.
+ ppToCommit->notify(inst);
// Some instructions will be sent to commit without having
// executed because they need commit to handle them.
#define __CPU_O3_RENAME_HH__
#include <list>
+#include <utility>
#include "base/statistics.hh"
#include "config/the_isa.hh"
#include "cpu/timebuf.hh"
+#include "sim/probe/probe.hh"
struct DerivO3CPUParams;
/** Per-thread status. */
ThreadStatus renameStatus[Impl::MaxThreads];
+ /** Probe points. */
+ typedef typename std::pair<InstSeqNum, short int> SeqNumRegPair;
+ /** To probe when register renaming for an instruction is complete */
+ ProbePointArg<DynInstPtr> *ppRename;
+ /**
+ * To probe when an instruction is squashed and the register mapping
+ * for it needs to be undone
+ */
+ ProbePointArg<SeqNumRegPair> *ppSquashInRename;
+
public:
/** DefaultRename constructor. */
DefaultRename(O3CPU *_cpu, DerivO3CPUParams *params);
/** Registers statistics. */
void regStats();
+ /** Registers probes. */
+ void regProbePoints();
+
/** Sets the main backwards communication time buffer pointer. */
void setTimeBuffer(TimeBuffer<TimeStruct> *tb_ptr);
.prereq(fpRenameLookups);
}
+template <class Impl>
+void
+DefaultRename<Impl>::regProbePoints()
+{
+ ppRename = new ProbePointArg<DynInstPtr>(cpu->getProbeManager(), "Rename");
+ ppSquashInRename = new ProbePointArg<SeqNumRegPair>(cpu->getProbeManager(),
+ "SquashInRename");
+}
+
template <class Impl>
void
DefaultRename<Impl>::setTimeBuffer(TimeBuffer<TimeStruct> *tb_ptr)
storesInProgress[tid]++;
}
++renamed_insts;
-
+ // Notify potential listeners that source and destination registers for
+ // this instruction have been renamed.
+ ppRename->notify(inst);
// Put instruction in rename queue.
toIEW->insts[toIEWIndex] = inst;
freeList->addReg(hb_it->newPhysReg);
}
+ // Notify potential listeners that the register mapping needs to be
+ // removed because the instruction it was mapped to got squashed. Note
+ // that this is done before hb_it is incremented.
+ ppSquashInRename->notify(std::make_pair(hb_it->instSeqNum,
+ hb_it->newPhysReg));
+
historyBuffer[tid].erase(hb_it++);
++renameUndoneMaps;