Ruby system was recently converted to a clocked object. Such objects maintain
state related to the time that has passed so far. During the cache warmup, Ruby
system changes its own time and the global time. Later on, the global time is
restored. So Ruby system also needs to reset its own time.
Tick curtick_original = curTick();
// save the event queue head
Event* eventq_head = eventq->replaceHead(NULL);
- // set curTick to 0
+ // set curTick to 0 and reset Ruby System's clock
curTick(0);
+ resetClock();
// Schedule an event to start cache warmup
enqueueRubyEvent(curTick());
m_memory_controller->reset();
// Restore eventq head
eventq_head = eventq->replaceHead(eventq_head);
- // Restore curTick
+ // Restore curTick and Ruby System's clock
curTick(curtick_original);
+ resetClock();
}
}
*/
virtual ~ClockedObject() { }
+ /**
+ * Reset the object's clock using the current global tick value. Likely
+ * to be used only when the global clock is reset. Currently, this done
+ * only when Ruby is done warming up the memory system.
+ */
+ void resetClock() const
+ {
+ Cycles elapsedCycles(divCeil(curTick(), clock));
+ cycle = elapsedCycles;
+ tick = elapsedCycles * clock;
+ }
+
public:
/**