Go to the documentation of this file.
35 #ifndef __SIM_EVENTQ_HH__
36 #define __SIM_EVENTQ_HH__
50 #include "debug/Event.hh"
95 typedef ::Flags<FlagsType>
Flags;
347 virtual void trace(
const char *action);
429 virtual const std::string
name()
const;
527 return l.when() <
r.when() ||
528 (
l.when() ==
r.when() &&
l.priority() <
r.priority());
537 return l.when() >
r.when() ||
538 (
l.when() ==
r.when() &&
l.priority() >
r.priority());
547 return l.when() <
r.when() ||
548 (
l.when() ==
r.when() &&
l.priority() <=
r.priority());
557 return l.when() >
r.when() ||
558 (
l.when() ==
r.when() &&
l.priority() >=
r.priority());
567 return l.when() ==
r.when() &&
l.priority() ==
r.priority();
576 return l.when() !=
r.when() ||
l.priority() !=
r.priority();
760 assert(!
event->scheduled());
761 assert(
event->initialized());
763 event->setWhen(when,
this);
781 event->trace(
"scheduled");
792 assert(
event->scheduled());
793 assert(
event->initialized());
802 event->trace(
"descheduled");
817 assert(always ||
event->scheduled());
818 assert(
event->initialized());
821 if (
event->scheduled()) {
827 event->setWhen(when,
this);
833 event->trace(
"rescheduled");
1069 template <
class T,
void (T::* F)()>
1095 return object->name() +
".wrapped_event";
1115 const std::string &
name,
1135 return _name +
".wrapped_function_event";
1144 #endif // __SIM_EVENTQ_HH__
EventWrapper(T *obj, bool del=false, Priority p=Default_Pri)
const char * description() const
Return a C string describing the event.
Priority _priority
event priority
bool scheduled() const
Determine if the current event is scheduled.
static const FlagsType AutoDelete
void unserialize(CheckpointIn &cp) override
Unserialize an object.
ScopedMigration(EventQueue *_new_eq, bool _doMigrate=true)
Temporarily migrate execution to a different event queue.
virtual const std::string name() const
EventWrapper(T &obj, bool del=false, Priority p=Default_Pri)
Counter instance
This event's unique ID.
std::mutex async_queue_mutex
Mutex to protect async queue.
static Event * insertBefore(Event *event, Event *curr)
void reschedule(Event *event, Tick when, bool always=false)
Reschedule the specified event.
static const Priority CPU_Tick_Pri
CPU ticks must come after other associated CPU events (such as writebacks).
void reschedule(Event *event, Tick when, bool always=false)
static const Priority Stat_Event_Pri
Statistics events (dump, reset, etc.) come after everything else, but before exit.
Tick _when
timestamp when event should be processed
void checkpointReschedule(Event *event)
Reschedule an event after a checkpoint.
static const FlagsType InitMask
bool isExitEvent() const
See if this is a SimExitEvent (without resorting to RTTI)
bool squashed() const
Check whether the event is squashed.
void reschedule(Event &event, Tick when, bool always=false)
static const FlagsType Scheduled
Event * replaceHead(Event *s)
function for replacing the head of the event queue, so that a different set of events can run without...
void setWhen(Tick when, EventQueue *q)
void schedule(Event *event, Tick when)
std::list< Event * > async_queue
List of events added by other threads to this event queue.
bool operator==(const Event &l, const Event &r)
Basic support for object serialization.
virtual void acquireImpl()
uint64_t Tick
Tick count type.
uint32_t numMainEventQueues
Current number of allocated main event queues.
void dump() const
Dump the current event data.
bool operator!=(const Event &l, const Event &r)
bool operator<=(const Event &l, const Event &r)
static const FlagsType IsExitEvent
void deschedule(Event &event)
void dump() const
This is a debugging function which will print everything on the event queue.
virtual const char * description() const
Return a C string describing the event.
static const FlagsType IsMainQueue
virtual void wakeup(Tick when=(Tick) -1)
Function to signal that the event loop should be woken up because an event has been scheduled by an a...
Tick when() const
Get the time that the event is scheduled.
EventQueue * getEventQueue(uint32_t index)
Function for returning eventq queue for the provided index.
static const Priority Delayed_Writeback_Pri
For some reason "delayed" inter-cluster writebacks are scheduled before regular writebacks (which hav...
bool operator<(const Event &l, const Event &r)
Tick simQuantum
Simulation Quantum for multiple eventq simulation.
ScopedRelease(EventQueue *_eq)
Temporarily release the event queue service lock.
Tick getCurTick() const
While curTick() is useful for any object assigned to this event queue, if an object that is assigned ...
static const FlagsType PublicRead
void name(const std::string &st)
static const FlagsType Managed
::Flags< FlagsType > Flags
static const Priority CPU_Exit_Pri
If we want to exit a thread in a CPU, it comes after CPU_Tick_Pri.
int64_t Counter
Statistics counter type.
void schedule(Event &event, Tick when)
static const Priority Sim_Exit_Pri
If we want to exit on this cycle, it's the very last thing we do.
void acquire()
Memory management hooks for events that have the Managed flag set.
static const Priority Minimum_Pri
Event priorities, to provide tie-breakers for events scheduled at the same cycle.
bool operator>(const Event &l, const Event &r)
static const FlagsType Reserved0
This used to be AutoSerialize.
EventFunctionWrapper(const std::function< void(void)> &callback, const std::string &name, bool del=false, Priority p=Default_Pri)
This function wraps a function into an event, to be executed later.
EventManager(EventQueue *eq)
void setCurTick(Tick newVal)
static const Priority DVFS_Update_Pri
DVFS update event leads to stats dump therefore given a lower priority to ensure all relevant states ...
bool empty() const
Returns true if no events are queued.
void serviceEvents(Tick when)
process all events up to the given timestamp.
bool inParallelMode
Current mode of execution: parallel / serial.
void setFlags(Flags _flags)
bool isManaged() const
Check whether this event will auto-delete.
void handleAsyncInsertions()
Function for moving events from the async_queue to the main queue.
static const Priority Debug_Enable_Pri
If we enable tracing on a particular cycle, do that as the very first thing so we don't miss any of t...
virtual void trace(const char *action)
This function isn't really useful if TRACING_ON is not defined.
EventQueue * curEventQueue()
static const Priority Maximum_Pri
Maximum priority.
bool isFlagSet(Flags _flags) const
void asyncInsert(Event *event)
Function for adding events to the async queue.
static const Priority Serialize_Pri
Serailization needs to occur before tick events also, so that a serialize/unserialize is identical to...
const std::string instanceString() const
Return the instance number as a string.
Priority priority() const
Get the event priority.
static const FlagsType PublicWrite
void setCurTick(Tick newVal)
void insert(Event *event)
Insert / remove event from the queue.
EventQueue * eventQueue() const
void clearFlags(Flags _flags)
virtual BaseGlobalEvent * globalEvent()
If this is part of a GlobalEvent, return the pointer to the Global Event.
static const Priority Debug_Break_Pri
Breakpoints should happen before anything else (except enabling trace output), so we don't miss any a...
virtual void releaseImpl()
const char * description() const
Return a C string describing the event.
void schedule(Event *event, Tick when, bool global=false)
Schedule the given event on this queue.
void lock()
Provide an interface for locking/unlocking the event queue.
void release()
Managed event removed from the event queue.
bool isAutoDelete() const
The function returns true if the object is automatically deleted after the event is processed.
static const Priority CPU_Switch_Pri
CPU switches schedule the new CPU's tick event for the same cycle (after unscheduling the old CPU's t...
void remove(Event *event)
bool operator>=(const Event &l, const Event &r)
void deschedule(Event *event)
Deschedule the specified event.
static const Priority Default_Pri
Default is zero for historical reasons.
EventQueue * eventq
A pointer to this object's event queue.
void squash()
Squash the current event.
static Event * removeItem(Event *event, Event *last)
void deschedule(Event *event)
Common base class for Event and GlobalEvent, so they can share flag and priority definitions and acce...
void wakeupEventQueue(Tick when=(Tick) -1)
This function is not needed by the usual gem5 event loop but may be necessary in derived EventQueues ...
std::ostream CheckpointOut
static const FlagsType Squashed
Event(Priority p=Default_Pri, Flags f=0)
Queue of events sorted in time order.
EventQueue(const EventQueue &)
static const Priority Progress_Event_Pri
Progress events come at the end.
const std::string name() const
EventManager(EventManager *em)
virtual const std::string name() const
std::function< void(void)> callback
Common base class for GlobalEvent and GlobalSyncEvent.
const std::string name() const
std::vector< EventQueue * > mainEventQueue
Array for main event queues.
static const FlagsType Initialized
std::mutex service_mutex
Lock protecting event handling.
static Counter instanceCounter
Global counter to generate unique IDs for Event instances.
void serialize(CheckpointOut &cp) const override
Serialize an object.
EventManager(EventManager &em)
Event manger manages events in the event queue.
Tick curTick()
The current simulated tick.
__thread EventQueue * _curEventQueue
The current event queue for the running thread.
EventQueue * queue
queue to which this event belongs (though it may or may not be scheduled on this queue yet)
Generated on Wed Sep 30 2020 14:02:14 for gem5 by doxygen 1.8.17