summaryrefslogtreecommitdiff
path: root/src/cpu/simple
diff options
context:
space:
mode:
authorAndreas Sandberg <Andreas.Sandberg@ARM.com>2014-10-16 05:49:41 -0400
committerAndreas Sandberg <Andreas.Sandberg@ARM.com>2014-10-16 05:49:41 -0400
commite0074324bacf500f9d0cc11ebc6e2f29bf3d8ba1 (patch)
tree0ecfcd3d7e3633251a8f632fe7ee5542a67fb8df /src/cpu/simple
parent9d35d48e848914fd6cf18b016cb9125c50e422c0 (diff)
downloadgem5-e0074324bacf500f9d0cc11ebc6e2f29bf3d8ba1.tar.xz
cpu: Probe points for basic PMU stats
This changeset adds probe points that can be used to implement PMU counters for CPU stats. The following probes are supported: * BaseCPU::ppCycles / Cycles * BaseCPU::ppRetiredInsts / RetiredInsts * BaseCPU::ppRetiredLoads / RetiredLoads * BaseCPU::ppRetiredStores / RetiredStores * BaseCPU::ppRetiredBranches RetiredBranches
Diffstat (limited to 'src/cpu/simple')
-rw-r--r--src/cpu/simple/atomic.cc7
-rw-r--r--src/cpu/simple/base.cc3
-rw-r--r--src/cpu/simple/timing.cc29
-rw-r--r--src/cpu/simple/timing.hh4
4 files changed, 30 insertions, 13 deletions
diff --git a/src/cpu/simple/atomic.cc b/src/cpu/simple/atomic.cc
index 5af3854e7..d6dbb9292 100644
--- a/src/cpu/simple/atomic.cc
+++ b/src/cpu/simple/atomic.cc
@@ -233,7 +233,9 @@ AtomicSimpleCPU::activateContext(ThreadID thread_num)
assert(!tickEvent.scheduled());
notIdleFraction = 1;
- numCycles += ticksToCycles(thread->lastActivate - thread->lastSuspend);
+ Cycles delta = ticksToCycles(thread->lastActivate - thread->lastSuspend);
+ numCycles += delta;
+ ppCycles->notify(delta);
//Make sure ticks are still on multiples of cycles
schedule(tickEvent, clockEdge(Cycles(0)));
@@ -501,6 +503,7 @@ AtomicSimpleCPU::tick()
for (int i = 0; i < width || locked; ++i) {
numCycles++;
+ ppCycles->notify(1);
if (!curStaticInst || !curStaticInst->isDelayedCommit())
checkForInterrupts();
@@ -614,6 +617,8 @@ AtomicSimpleCPU::tick()
void
AtomicSimpleCPU::regProbePoints()
{
+ BaseCPU::regProbePoints();
+
ppCommit = new ProbePointArg<pair<SimpleThread*, const StaticInstPtr>>
(getProbeManager(), "Commit");
}
diff --git a/src/cpu/simple/base.cc b/src/cpu/simple/base.cc
index 6101ff30f..60ab53999 100644
--- a/src/cpu/simple/base.cc
+++ b/src/cpu/simple/base.cc
@@ -544,6 +544,9 @@ BaseSimpleCPU::postExecute()
delete traceData;
traceData = NULL;
}
+
+ // Call CPU instruction commit probes
+ probeInstCommit(curStaticInst);
}
void
diff --git a/src/cpu/simple/timing.cc b/src/cpu/simple/timing.cc
index 9a9714bee..84a2c09fd 100644
--- a/src/cpu/simple/timing.cc
+++ b/src/cpu/simple/timing.cc
@@ -178,7 +178,7 @@ TimingSimpleCPU::switchOut()
assert(!stayAtPC);
assert(microPC() == 0);
- numCycles += curCycle() - previousCycle;
+ updateCycleCounts();
}
@@ -332,8 +332,7 @@ TimingSimpleCPU::translationFault(const Fault &fault)
{
// fault may be NoFault in cases where a fault is suppressed,
// for instance prefetches.
- numCycles += curCycle() - previousCycle;
- previousCycle = curCycle();
+ updateCycleCounts();
if (traceData) {
// Since there was a fault, we shouldn't trace this instruction.
@@ -569,8 +568,7 @@ TimingSimpleCPU::fetch()
_status = IcacheWaitResponse;
completeIfetch(NULL);
- numCycles += curCycle() - previousCycle;
- previousCycle = curCycle();
+ updateCycleCounts();
}
}
@@ -603,8 +601,7 @@ TimingSimpleCPU::sendFetch(const Fault &fault, RequestPtr req,
advanceInst(fault);
}
- numCycles += curCycle() - previousCycle;
- previousCycle = curCycle();
+ updateCycleCounts();
}
@@ -651,8 +648,7 @@ TimingSimpleCPU::completeIfetch(PacketPtr pkt)
_status = BaseSimpleCPU::Running;
- numCycles += curCycle() - previousCycle;
- previousCycle = curCycle();
+ updateCycleCounts();
if (pkt)
pkt->req->setAccessLatency();
@@ -753,8 +749,8 @@ TimingSimpleCPU::completeDataAccess(PacketPtr pkt)
pkt->req->getFlags().isSet(Request::NO_ACCESS));
pkt->req->setAccessLatency();
- numCycles += curCycle() - previousCycle;
- previousCycle = curCycle();
+
+ updateCycleCounts();
if (pkt->senderState) {
SplitFragmentSenderState * send_state =
@@ -809,6 +805,17 @@ TimingSimpleCPU::completeDataAccess(PacketPtr pkt)
}
void
+TimingSimpleCPU::updateCycleCounts()
+{
+ const Cycles delta(curCycle() - previousCycle);
+
+ numCycles += delta;
+ ppCycles->notify(delta);
+
+ previousCycle = curCycle();
+}
+
+void
TimingSimpleCPU::DcachePort::recvTimingSnoopReq(PacketPtr pkt)
{
TheISA::handleLockedSnoop(cpu->thread, pkt, cacheBlockMask);
diff --git a/src/cpu/simple/timing.hh b/src/cpu/simple/timing.hh
index 24f7002ff..84c8f7418 100644
--- a/src/cpu/simple/timing.hh
+++ b/src/cpu/simple/timing.hh
@@ -245,13 +245,15 @@ class TimingSimpleCPU : public BaseSimpleCPU
};
+ void updateCycleCounts();
+
IcachePort icachePort;
DcachePort dcachePort;
PacketPtr ifetch_pkt;
PacketPtr dcache_pkt;
- Tick previousCycle;
+ Cycles previousCycle;
protected: