Go to the documentation of this file.
35 #ifndef __SIM_EVENTQ_HH__
36 #define __SIM_EVENTQ_HH__
54 #include "debug/Event.hh"
62 class BaseGlobalEvent;
103 typedef ::gem5::Flags<FlagsType>
Flags;
355 virtual void trace(
const char *action);
427 virtual const std::string
name()
const;
525 return l.when() <
r.when() ||
526 (
l.when() ==
r.when() &&
l.priority() <
r.priority());
535 return l.when() >
r.when() ||
536 (
l.when() ==
r.when() &&
l.priority() >
r.priority());
545 return l.when() <
r.when() ||
546 (
l.when() ==
r.when() &&
l.priority() <=
r.priority());
555 return l.when() >
r.when() ||
556 (
l.when() ==
r.when() &&
l.priority() >=
r.priority());
565 return l.when() ==
r.when() &&
l.priority() ==
r.priority();
574 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");
1098 [[deprecated(
"Use reference version of this constructor instead")]]
1116 Named(object.
name() +
".wrapped_event"),
1132 template <
class T,
void (T::* F)()>
1133 using EventWrapper [[deprecated(
"Use MemberEventWrapper instead")]]
1150 const std::string &
name,
1170 return _name +
".wrapped_function_event";
1184 #define SERIALIZE_EVENT(event) event.serializeSection(cp, #event);
1191 #define UNSERIALIZE_EVENT(event) \
1193 event.unserializeSection(cp, #event); \
1194 eventQueue()->checkpointReschedule(&event); \
1199 #endif // __SIM_EVENTQ_HH__
void name(const std::string &st)
Tick curTick()
The universal simulation clock.
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.
::gem5::Flags< FlagsType > Flags
EventManager(EventManager &em)
Event manger manages events in the event queue.
bool isExitEvent() const
See if this is a SimExitEvent (without resorting to RTTI)
virtual const char * description() const
Return a C string describing the event.
bool isManaged() const
Check whether this event will auto-delete.
Tick when() const
Get the time that the event is scheduled.
bool operator>=(const Time &l, const Time &r)
virtual const std::string name() const
Event * replaceHead(Event *s)
function for replacing the head of the event queue, so that a different set of events can run without...
EventQueue * eventQueue() const
MemberEventWrapper(CLASS *object, bool del=false, Priority p=Default_Pri)
static const FlagsType Reserved0
This used to be AutoSerialize.
std::vector< EventQueue * > mainEventQueue
Array for main event queues.
Event(Priority p=Default_Pri, Flags f=0)
void set(Type mask)
Set all flag's bits matching the given mask.
void clear()
Clear all flag's bits.
static const Priority Delayed_Writeback_Pri
For some reason "delayed" inter-cluster writebacks are scheduled before regular writebacks (which hav...
static const FlagsType InitMask
static Event * removeItem(Event *event, Event *last)
static const FlagsType Scheduled
EventQueue * getEventQueue(uint32_t index)
Function for returning eventq queue for the provided index.
void reschedule(Event *event, Tick when, bool always=false)
Reschedule the specified event.
bool inParallelMode
Current mode of execution: parallel / serial.
EventQueue * queue
queue to which this event belongs (though it may or may not be scheduled on this queue yet)
void lock()
Provide an interface for locking/unlocking the event queue.
void schedule(Event *event, Tick when)
void schedule(Event &event, Tick when)
void release()
Managed event removed from the event queue.
static const Priority DVFS_Update_Pri
DVFS update event leads to stats dump therefore given a lower priority to ensure all relevant states ...
std::function< void(void)> callback
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...
static const Priority CPU_Exit_Pri
If we want to exit a thread in a CPU, it comes after CPU_Tick_Pri.
MemberFunctionClass_t< F > CLASS
MemberEventWrapper(CLASS &object, bool del=false, Priority p=Default_Pri)
Construct a new MemberEventWrapper object.
virtual void releaseImpl()
void serviceEvents(Tick when)
process all events up to the given timestamp.
static const Priority Progress_Event_Pri
Progress events come at the end.
void setFlags(Flags _flags)
std::list< Event * > async_queue
List of events added by other threads to this event queue.
Priority priority() const
Get the event priority.
static const FlagsType AutoDelete
Interface for things with names.
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...
typename MemberFunctionSignature< decltype(F)>::argsTuple_t MemberFunctionArgsTuple_t
bool operator<=(const Time &l, const Time &r)
static const FlagsType Squashed
const char * description() const override
Return a C string describing the event.
void handleAsyncInsertions()
Function for moving events from the async_queue to the main queue.
Basic support for object serialization.
void insert(Event *event)
Insert / remove event from the queue.
static const FlagsType IsExitEvent
Common base class for GlobalEvent and GlobalSyncEvent.
virtual std::string name() const
void setCurTick(Tick newVal)
bool isSet(Type mask) const
Verifies whether any bit matching the given mask is set.
static const Priority Minimum_Pri
Event priorities, to provide tie-breakers for events scheduled at the same cycle.
static Counter instanceCounter
Global counter to generate unique IDs for Event instances.
void deschedule(Event *event)
Deschedule the specified event.
static const FlagsType IsMainQueue
uint64_t Tick
Tick count type.
const std::string name() const
static const Priority Maximum_Pri
Maximum priority.
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...
void setCurTick(Tick newVal)
UncontendedMutex async_queue_mutex
Mutex to protect async queue.
EventQueue * eventq
A pointer to this object's event queue.
EventQueue(const EventQueue &)
static const Priority Debug_Break_Pri
Breakpoints should happen before anything else (except enabling trace output), so we don't miss any a...
void clearFlags(Flags _flags)
Queue of events sorted in time order.
void deschedule(Event *event)
static const FlagsType Initialized
virtual BaseGlobalEvent * globalEvent()
If this is part of a GlobalEvent, return the pointer to the Global Event.
Tick simQuantum
Simulation Quantum for multiple eventq simulation.
bool empty() const
Returns true if no events are queued.
typename MemberFunctionSignature< decltype(F)>::class_t MemberFunctionClass_t
void reschedule(Event &event, Tick when, bool always=false)
__thread EventQueue * _curEventQueue
The current event queue for the running thread.
void wakeupEventQueue(Tick when=(Tick) -1)
This function is not needed by the usual gem5 event loop but may be necessary in derived EventQueues ...
bool isAutoDelete() const
The function returns true if the object is automatically deleted after the event is processed.
void acquire()
Memory management hooks for events that have the Managed flag set.
static const FlagsType Managed
friend void curEventQueue(EventQueue *)
EventManager(EventQueue *eq)
bool operator>(const Time &l, const Time &r)
Tick getCurTick() const
While curTick() is useful for any object assigned to this event queue, if an object that is assigned ...
static const Priority Stat_Event_Pri
Statistics events (dump, reset, etc.) come after everything else, but before exit.
void deschedule(Event &event)
Priority _priority
event priority
static const FlagsType PublicRead
void reschedule(Event *event, Tick when, bool always=false)
Tick _when
timestamp when event should be processed
void serialize(CheckpointOut &cp) const override
Serialize an object.
void setWhen(Tick when, EventQueue *q)
EventQueue * curEventQueue()
static bool operator==(const PCStateBase &a, const PCStateBase &b)
void checkpointReschedule(Event *event)
Reschedule an event after a checkpoint.
bool squashed() const
Check whether the event is squashed.
virtual void acquireImpl()
uint32_t numMainEventQueues
Current number of allocated main event queues.
bool isFlagSet(Flags _flags) const
static Event * insertBefore(Event *event, Event *curr)
const char * description() const
Return a C string describing the event.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void asyncInsert(Event *event)
Function for adding events to the async queue.
double Counter
All counters are of 64-bit values.
void remove(Event *event)
void schedule(Event *event, Tick when, bool global=false)
Schedule the given event on this queue.
bool operator<(const Time &l, const Time &r)
const std::string instanceString() const
Return the instance number as a string.
std::ostream CheckpointOut
typename MemberFunctionSignature< decltype(F)>::return_t MemberFunctionReturn_t
Common base class for Event and GlobalEvent, so they can share flag and priority definitions and acce...
void squash()
Squash the current event.
#define gem5_assert(cond,...)
The assert macro will function like a normal assert, but will use panic instead of straight abort().
static const Priority CPU_Tick_Pri
CPU ticks must come after other associated CPU events (such as writebacks).
static const Priority Default_Pri
Default is zero for historical reasons.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Counter instance
This event's unique ID.
EventManager(EventManager *em)
static bool operator!=(const PCStateBase &a, const PCStateBase &b)
virtual const std::string name() const
UncontendedMutex service_mutex
Lock protecting event handling.
virtual void trace(const char *action)
This function isn't really useful if TRACING_ON is not defined.
ScopedRelease(EventQueue *_eq)
Temporarily release the event queue service lock.
__thread Tick * _curTickPtr
static const Priority Serialize_Pri
Serailization needs to occur before tick events also, so that a serialize/unserialize is identical to...
ScopedMigration(EventQueue *_new_eq, bool _doMigrate=true)
Temporarily migrate execution to a different event queue.
bool scheduled() const
Determine if the current event is scheduled.
void dump() const
Dump the current event data.
bool noneSet(Type mask) const
Verifies whether no bits matching the given mask are set.
Wrap a member function inside MemberEventWrapper to use it as an event callback.
static const Priority Sim_Exit_Pri
If we want to exit on this cycle, it's the very last thing we do.
void dump() const
This is a debugging function which will print everything on the event queue.
static const FlagsType PublicWrite
Generated on Sun Jul 30 2023 01:56:59 for gem5 by doxygen 1.8.17