summaryrefslogtreecommitdiff
path: root/src/sim/ticked_object.hh
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/sim/ticked_object.hh
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/sim/ticked_object.hh')
-rw-r--r--src/sim/ticked_object.hh15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/sim/ticked_object.hh b/src/sim/ticked_object.hh
index 5bca92443..ee143e0df 100644
--- a/src/sim/ticked_object.hh
+++ b/src/sim/ticked_object.hh
@@ -76,6 +76,7 @@ class Ticked
{
++owner.tickCycles;
++owner.numCycles;
+ owner.countCycles(Cycles(1));
owner.evaluate();
if (owner.running) {
owner.object.schedule(this,
@@ -132,6 +133,7 @@ class Ticked
object.schedule(event, object.clockEdge(Cycles(1)));
running = true;
numCycles += cyclesSinceLastStopped();
+ countCycles(cyclesSinceLastStopped());
}
}
@@ -167,6 +169,19 @@ class Ticked
/** Action to call on the clock tick */
virtual void evaluate() = 0;
+
+ /**
+ * Callback to handle cycle statistics and probes.
+ *
+ * This callback is called at the beginning of a new cycle active
+ * cycle and when restarting the ticked object. The delta
+ * parameter indicates the number of cycles elapsed since the
+ * previous call is normally '1' unless the object has been
+ * stopped and restarted.
+ *
+ * @param delta Number of cycles since the previous call.
+ */
+ virtual void countCycles(Cycles delta) {}
};
/** TickedObject attaches Ticked to ClockedObject and can be used as