summaryrefslogtreecommitdiff
path: root/src/sim/ticked_object.hh
diff options
context:
space:
mode:
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