#include "base/logging.hh"
#include "systemc/core/channel.hh"
+#include "systemc/core/scheduler.hh"
#include "systemc/ext/core/sc_prim.hh"
+namespace sc_gem5
+{
+
+uint64_t getChangeStamp() { return scheduler.changeStamp(); }
+
+} // namespace sc_gem5
+
namespace sc_core
{
starvationEvent(this, false, StarvationPriority),
_started(false), _paused(false), _stopped(false),
maxTickEvent(this, false, MaxTickPriority),
- _numCycles(0), _current(nullptr), initDone(false),
+ _numCycles(0), _changeStamp(0), _current(nullptr), initDone(false),
runOnce(false)
{}
Scheduler::runReady()
{
bool empty = readyList.empty();
+ lastReadyTick = getCurTick();
// The evaluation phase.
do {
yield();
} while (!readyList.empty());
- if (!empty)
+ if (!empty) {
_numCycles++;
+ _changeStamp++;
+ }
// The update phase.
update();
runToTime = run_to_time;
maxTick = max_tick;
+ lastReadyTick = getCurTick();
if (initDone) {
if (!runToTime && starved())
void
completeTimeSlot(TimeSlot *ts)
{
+ _changeStamp++;
assert(ts == timeSlots.begin()->second);
timeSlots.erase(timeSlots.begin());
if (!runToTime && starved())
bool paused() { return _paused; }
bool stopped() { return _stopped; }
+ uint64_t changeStamp() { return _changeStamp; }
+
private:
typedef const EventBase::Priority Priority;
static Priority DefaultPriority = EventBase::Default_Pri;
bool _stopped;
Tick maxTick;
- EventWrapper<Scheduler, &Scheduler::pause> maxTickEvent;
+ Tick lastReadyTick;
+ void
+ maxTickFunc()
+ {
+ if (lastReadyTick != getCurTick())
+ _changeStamp++;
+ pause();
+ }
+ EventWrapper<Scheduler, &Scheduler::maxTickFunc> maxTickEvent;
uint64_t _numCycles;
+ uint64_t _changeStamp;
Process *_current;
class Channel;
+uint64_t getChangeStamp();
+
} // namespace sc_gem5
namespace sc_core