39,40d38
< #include <assert.h>
<
41a40
> #include <cassert>
46,47d44
< #include "sim/host.hh" // for Tick
<
51a49
> #include "sim/host.hh"
67d64
<
71a69,70
> *
> * Caution, the order of members is chosen to maximize data packing.
77a77
> Event *next;
78a79,86
> /// queue to which this event belongs (though it may or may not be
> /// scheduled on this queue yet)
> EventQueue *_queue;
>
> Tick _when; //!< timestamp when event should be processed
> short _priority; //!< event priority
> short _flags;
>
87,88c95,96
< Counter instanceId;
< #endif // NDEBUG
---
> Counter instance;
> #endif
90,99c98,101
< /// queue to which this event belongs (though it may or may not be
< /// scheduled on this queue yet)
< EventQueue *queue;
<
< Event *next;
<
< Tick _when; //!< timestamp when event should be processed
< int _priority; //!< event priority
< char _flags;
<
---
> #ifdef DEBUG_EVENTQ
> Tick whenCreated; //!< time created
> Tick whenScheduled; //!< time scheduled
> #endif
115c117
< EventQueue *theQueue() const { return queue; }
---
> EventQueue *queue() const { return _queue; }
117,120c119
< #if TRACING_ON
< Tick when_created; //!< Keep track of creation time For debugging
< Tick when_scheduled; //!< Keep track of creation time For debugging
<
---
> // This function isn't really useful if TRACING_ON is not defined
122,124d120
< #else
< void trace(const char *) {}
< #endif
126,127d121
< unsigned annotated_value;
<
129d122
<
134a128,130
> /// Minimum priority
> Minimum_Pri = SHRT_MIN,
>
177c173,176
< Sim_Exit_Pri = 100
---
> Sim_Exit_Pri = 100,
>
> /// Maximum priority
> Maximum_Pri = SHRT_MAX
185,189c184
< : queue(q), next(NULL), _priority(p), _flags(None),
< #if TRACING_ON
< when_created(curTick), when_scheduled(0),
< #endif
< annotated_value(0)
---
> : next(NULL), _queue(q), _priority(p), _flags(None)
192c187
< instanceId = ++instanceCounter;
---
> instance = ++instanceCounter;
193a189,192
> #ifdef EVENTQ_DEBUG
> whenCreated = curTick;
> whenScheduled = 0;
> #endif
196c195,198
< ~Event() {}
---
> virtual
> ~Event()
> {
> }
198c200,202
< virtual const std::string name() const {
---
> virtual const std::string
> name() const
> {
200c204
< return csprintf("Event_%d", instanceId);
---
> return csprintf("Event_%d", instance);
206,218d209
< /// Determine if the current event is scheduled
< bool scheduled() const { return getFlags(Scheduled); }
<
< /// Schedule the event with the current priority or default priority
< void schedule(Tick t);
<
< /// Reschedule the event with the current priority
< // always parameter means to schedule if not already scheduled
< void reschedule(Tick t, bool always = false);
<
< /// Remove the event from the current schedule
< void deschedule();
<
225c216
< void dump();
---
> void dump() const;
226a218
> public:
239,240c231,232
< void annotate(unsigned value) { annotated_value = value; };
< unsigned annotation() { return annotated_value; }
---
> /// Determine if the current event is scheduled
> bool scheduled() const { return getFlags(Scheduled); }
241a234,243
> /// Schedule the event with the current priority or default priority
> void schedule(Tick t);
>
> /// Reschedule the event with the current priority
> // always parameter means to schedule if not already scheduled
> void reschedule(Tick t, bool always = false);
>
> /// Remove the event from the current schedule
> void deschedule();
>
246c248
< bool squashed() { return getFlags(Squashed); }
---
> bool squashed() const { return getFlags(Squashed); }
249c251
< bool isExitEvent() { return getFlags(IsExitEvent); }
---
> bool isExitEvent() const { return getFlags(IsExitEvent); }
257,258c259,260
< struct priority_compare :
< public std::binary_function<Event *, Event *, bool>
---
> struct priority_compare
> : public std::binary_function<Event *, Event *, bool>
260c262,264
< bool operator()(const Event *l, const Event *r) const {
---
> bool
> operator()(const Event *l, const Event *r) const
> {
346c350
< Tick nextTick() { return head->when(); }
---
> Tick nextTick() const { return head->when(); }
352c356,358
< void serviceEvents(Tick when) {
---
> void
> serviceEvents(Tick when)
> {
370c376
< bool empty() { return head == NULL; }
---
> bool empty() const { return head == NULL; }
372c378
< void dump();
---
> void dump() const;
396,397c402
< // if (t < curTick)
< // warn("t is less than curTick, ensure you don't want cycles");
---
> assert(t >= curTick);
400,401c405,406
< #if TRACING_ON
< when_scheduled = curTick;
---
> #ifdef DEBUG_EVENTQ
> whenScheduled = curTick;
404c409
< queue->schedule(this);
---
> _queue->schedule(this);
414c419
< queue->deschedule(this);
---
> _queue->deschedule(this);
420a426
> assert(t >= curTick);
422,423c428,429
< #if TRACING_ON
< when_scheduled = curTick;
---
> #ifdef DEBUG_EVENTQ
> whenScheduled = curTick;
429c435
< queue->reschedule(this);
---
> _queue->reschedule(this);
432c438
< queue->schedule(this);
---
> _queue->schedule(this);
449a456,458
>
> if (event->getFlags(Event::AutoDelete))
> delete event;
461,462d469
<
<