+schedStatEvent(bool dump, bool reset, Tick when, Tick repeat)
+{
+ // simQuantum is being added to the time when the stats would be
+ // dumped so as to ensure that this event happens only after the next
+ // sync amongst the event queues. Asingle event queue simulation
+ // should remain unaffected.
+ dumpEvent = new StatEvent(when + simQuantum, dump, reset, repeat);
+}
+
+void
+periodicStatDump(Tick period)
+{
+ /*
+ * If the period is set to 0, then we do not want to dump periodically,
+ * thus we deschedule the event. Else, if the period is not 0, but the event
+ * has already been scheduled, we need to get rid of the old event before we
+ * create a new one, as the old event will no longer be moved forward in the
+ * event that we resume from a checkpoint.
+ */
+ if (dumpEvent != NULL && (period == 0 || dumpEvent->scheduled())) {
+ // Event should AutoDelete, so we do not need to free it.
+ dumpEvent->deschedule();
+ }
+
+ /*
+ * If the period is not 0, we schedule the event. If this is called with a
+ * period that is less than the current tick, then we shift the first dump
+ * by curTick. This ensures that we do not schedule the event is the past.
+ */
+ if (period != 0) {
+ // Schedule the event
+ if (period >= curTick()) {
+ schedStatEvent(true, true, (Tick)period, (Tick)period);
+ } else {
+ schedStatEvent(true, true, (Tick)period + curTick(), (Tick)period);
+ }
+ }
+}
+
+void
+updateEvents()