gem5  v21.0.1.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
eventq.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2000-2005 The Regents of The University of Michigan
3  * Copyright (c) 2013 Advanced Micro Devices, Inc.
4  * Copyright (c) 2013 Mark D. Hill and David A. Wood
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are
9  * met: redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer;
11  * redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution;
14  * neither the name of the copyright holders nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 /* @file
32  * EventQueue interfaces
33  */
34 
35 #ifndef __SIM_EVENTQ_HH__
36 #define __SIM_EVENTQ_HH__
37 
38 #include <algorithm>
39 #include <cassert>
40 #include <climits>
41 #include <functional>
42 #include <iosfwd>
43 #include <list>
44 #include <memory>
45 #include <string>
46 
47 #include "base/debug.hh"
48 #include "base/flags.hh"
49 #include "base/types.hh"
51 #include "debug/Event.hh"
52 #include "sim/core.hh"
53 #include "sim/serialize.hh"
54 
55 class EventQueue; // forward declaration
56 class BaseGlobalEvent;
57 
63 extern Tick simQuantum;
64 
66 extern uint32_t numMainEventQueues;
67 
70 
73 
74 extern __thread EventQueue *_curEventQueue;
75 
77 extern bool inParallelMode;
78 
83 EventQueue *getEventQueue(uint32_t index);
84 
86 inline void curEventQueue(EventQueue *q);
87 
93 class EventBase
94 {
95  protected:
96  typedef unsigned short FlagsType;
97  typedef ::Flags<FlagsType> Flags;
98 
99  static const FlagsType PublicRead = 0x003f; // public readable flags
100  static const FlagsType PublicWrite = 0x001d; // public writable flags
101  static const FlagsType Squashed = 0x0001; // has been squashed
102  static const FlagsType Scheduled = 0x0002; // has been scheduled
103  static const FlagsType Managed = 0x0004; // Use life cycle manager
104  static const FlagsType AutoDelete = Managed; // delete after dispatch
110  static const FlagsType Reserved0 = 0x0008;
111  static const FlagsType IsExitEvent = 0x0010; // special exit event
112  static const FlagsType IsMainQueue = 0x0020; // on main event queue
113  static const FlagsType Initialized = 0x7a40; // somewhat random bits
114  static const FlagsType InitMask = 0xffc0; // mask for init bits
115 
116  public:
120  typedef int8_t Priority;
121 
126 
132  static const Priority Minimum_Pri = SCHAR_MIN;
133 
141  static const Priority Debug_Enable_Pri = -101;
142 
150  static const Priority Debug_Break_Pri = -100;
151 
160  static const Priority CPU_Switch_Pri = -31;
161 
169  static const Priority Delayed_Writeback_Pri = -1;
170 
176  static const Priority Default_Pri = 0;
177 
184  static const Priority DVFS_Update_Pri = 31;
185 
193  static const Priority Serialize_Pri = 32;
194 
201  static const Priority CPU_Tick_Pri = 50;
202 
208  static const Priority CPU_Exit_Pri = 64;
209 
216  static const Priority Stat_Event_Pri = 90;
217 
223  static const Priority Progress_Event_Pri = 95;
224 
231  static const Priority Sim_Exit_Pri = 100;
232 
238  static const Priority Maximum_Pri = SCHAR_MAX;
239 };
240 
241 /*
242  * An item on an event queue. The action caused by a given
243  * event is specified by deriving a subclass and overriding the
244  * process() member function.
245  *
246  * Caution, the order of members is chosen to maximize data packing.
247  */
248 class Event : public EventBase, public Serializable
249 {
250  friend class EventQueue;
251 
252  private:
253  // The event queue is now a linked list of linked lists. The
254  // 'nextBin' pointer is to find the bin, where a bin is defined as
255  // when+priority. All events in the same bin will be stored in a
256  // second linked list (a stack) maintained by the 'nextInBin'
257  // pointer. The list will be accessed in LIFO order. The end
258  // result is that the insert/removal in 'nextBin' is
259  // linear/constant, and the lookup/removal in 'nextInBin' is
260  // constant/constant. Hopefully this is a significant improvement
261  // over the current fully linear insertion.
264 
265  static Event *insertBefore(Event *event, Event *curr);
266  static Event *removeItem(Event *event, Event *last);
267 
271 
272 #ifndef NDEBUG
273  static Counter instanceCounter;
275 
281 
285 #endif
286 
287 #ifdef EVENTQ_DEBUG
288  Tick whenCreated;
289  Tick whenScheduled;
290 #endif
291 
292  void
294  {
295  _when = when;
296 #ifndef NDEBUG
297  queue = q;
298 #endif
299 #ifdef EVENTQ_DEBUG
300  whenScheduled = curTick();
301 #endif
302  }
303 
304  bool
305  initialized() const
306  {
307  return (flags & InitMask) == Initialized;
308  }
309 
310  protected:
311  Flags
312  getFlags() const
313  {
314  return flags & PublicRead;
315  }
316 
317  bool
318  isFlagSet(Flags _flags) const
319  {
320  assert(_flags.noneSet(~PublicRead));
321  return flags.isSet(_flags);
322  }
323 
324  void
325  setFlags(Flags _flags)
326  {
327  assert(_flags.noneSet(~PublicWrite));
328  flags.set(_flags);
329  }
330 
331  void
333  {
334  assert(_flags.noneSet(~PublicWrite));
335  flags.clear(_flags);
336  }
337 
338  void
340  {
342  }
343 
349  virtual void trace(const char *action);
350 
352  const std::string instanceString() const;
353 
354  protected: /* Memory management */
380  void acquire()
381  {
383  acquireImpl();
384  }
385 
389  void release() {
391  releaseImpl();
392  }
393 
394  virtual void acquireImpl() {}
395 
396  virtual void releaseImpl() {
397  if (!scheduled())
398  delete this;
399  }
400 
403  public:
404 
405  /*
406  * Event constructor
407  * @param queue that the event gets scheduled on
408  *
409  * @ingroup api_eventq
410  */
412  : nextBin(nullptr), nextInBin(nullptr), _when(0), _priority(p),
413  flags(Initialized | f)
414  {
415  assert(f.noneSet(~PublicWrite));
416 #ifndef NDEBUG
418  queue = NULL;
419 #endif
420 #ifdef EVENTQ_DEBUG
421  whenCreated = curTick();
422  whenScheduled = 0;
423 #endif
424  }
425 
430  virtual ~Event();
431  virtual const std::string name() const;
432 
436  virtual const char *description() const;
437 
439  void dump() const; //end of api group
441 
442  public:
443  /*
444  * This member function is invoked when the event is processed
445  * (occurs). There is no default implementation; each subclass
446  * must provide its own implementation. The event is not
447  * automatically deleted after it is processed (to allow for
448  * statically allocated event objects).
449  *
450  * If the AutoDestroy flag is set, the object is deleted once it
451  * is processed.
452  *
453  * @ingroup api_eventq
454  */
455  virtual void process() = 0;
456 
462  bool scheduled() const { return flags.isSet(Scheduled); }
463 
469  void squash() { flags.set(Squashed); }
470 
476  bool squashed() const { return flags.isSet(Squashed); }
477 
483  bool isExitEvent() const { return flags.isSet(IsExitEvent); }
484 
490  bool isManaged() const { return flags.isSet(Managed); }
491 
498  bool isAutoDelete() const { return isManaged(); }
499 
505  Tick when() const { return _when; }
506 
512  Priority priority() const { return _priority; }
513 
517  virtual BaseGlobalEvent *globalEvent() { return NULL; }
518 
519  void serialize(CheckpointOut &cp) const override;
520  void unserialize(CheckpointIn &cp) override;
521 };
522 
526 inline bool
527 operator<(const Event &l, const Event &r)
528 {
529  return l.when() < r.when() ||
530  (l.when() == r.when() && l.priority() < r.priority());
531 }
532 
536 inline bool
537 operator>(const Event &l, const Event &r)
538 {
539  return l.when() > r.when() ||
540  (l.when() == r.when() && l.priority() > r.priority());
541 }
542 
546 inline bool
547 operator<=(const Event &l, const Event &r)
548 {
549  return l.when() < r.when() ||
550  (l.when() == r.when() && l.priority() <= r.priority());
551 }
552 
556 inline bool
557 operator>=(const Event &l, const Event &r)
558 {
559  return l.when() > r.when() ||
560  (l.when() == r.when() && l.priority() >= r.priority());
561 }
562 
566 inline bool
567 operator==(const Event &l, const Event &r)
568 {
569  return l.when() == r.when() && l.priority() == r.priority();
570 }
571 
575 inline bool
576 operator!=(const Event &l, const Event &r)
577 {
578  return l.when() != r.when() || l.priority() != r.priority();
579 }
580 
620 {
621  private:
622  friend void curEventQueue(EventQueue *);
623 
624  std::string objName;
627 
630 
633 
655 
658  void insert(Event *event);
659  void remove(Event *event);
660 
664  void asyncInsert(Event *event);
665 
666  EventQueue(const EventQueue &);
667 
668  public:
670  {
671  public:
686  ScopedMigration(EventQueue *_new_eq, bool _doMigrate = true)
687  :new_eq(*_new_eq), old_eq(*curEventQueue()),
688  doMigrate((&new_eq != &old_eq)&&_doMigrate)
689  {
690  if (doMigrate){
691  old_eq.unlock();
692  new_eq.lock();
694  }
695  }
696 
698  {
699  if (doMigrate){
700  new_eq.unlock();
701  old_eq.lock();
703  }
704  }
705 
706  private:
709  bool doMigrate;
710  };
711 
712 
714  {
715  public:
728  : eq(*_eq)
729  {
730  eq.unlock();
731  }
732 
734  {
735  eq.lock();
736  }
737 
738  private:
740  };
741 
745  EventQueue(const std::string &n);
746 
751  virtual const std::string name() const { return objName; }
752  void name(const std::string &st) { objName = st; } //end of api_eventq group
754 
760  void
761  schedule(Event *event, Tick when, bool global=false)
762  {
763  assert(when >= getCurTick());
764  assert(!event->scheduled());
765  assert(event->initialized());
766 
767  event->setWhen(when, this);
768 
769  // The check below is to make sure of two things
770  // a. A thread schedules local events on other queues through the
771  // asyncq.
772  // b. A thread schedules global events on the asyncq, whether or not
773  // this event belongs to this eventq. This is required to maintain
774  // a total order amongst the global events. See global_event.{cc,hh}
775  // for more explanation.
776  if (inParallelMode && (this != curEventQueue() || global)) {
778  } else {
779  insert(event);
780  }
781  event->flags.set(Event::Scheduled);
782  event->acquire();
783 
784  if (DTRACE(Event))
785  event->trace("scheduled");
786  }
787 
793  void
795  {
796  assert(event->scheduled());
797  assert(event->initialized());
798  assert(!inParallelMode || this == curEventQueue());
799 
800  remove(event);
801 
802  event->flags.clear(Event::Squashed);
803  event->flags.clear(Event::Scheduled);
804 
805  if (DTRACE(Event))
806  event->trace("descheduled");
807 
808  event->release();
809  }
810 
817  void
818  reschedule(Event *event, Tick when, bool always=false)
819  {
820  assert(when >= getCurTick());
821  assert(always || event->scheduled());
822  assert(event->initialized());
823  assert(!inParallelMode || this == curEventQueue());
824 
825  if (event->scheduled()) {
826  remove(event);
827  } else {
828  event->acquire();
829  }
830 
831  event->setWhen(when, this);
832  insert(event);
833  event->flags.clear(Event::Squashed);
834  event->flags.set(Event::Scheduled);
835 
836  if (DTRACE(Event))
837  event->trace("rescheduled");
838  }
839 
840  Tick nextTick() const { return head->when(); }
841  void setCurTick(Tick newVal) { _curTick = newVal; }
842 
854  Tick getCurTick() const { return _curTick; }
855  Event *getHead() const { return head; }
856 
857  Event *serviceOne();
858 
872  void
874  {
875  while (!empty()) {
876  if (nextTick() > when)
877  break;
878 
883  //assert(head->when() >= when && "event scheduled in the past");
884  serviceOne();
885  }
886 
887  setCurTick(when);
888  }
889 
895  bool empty() const { return head == NULL; }
896 
903  void dump() const;
904 
905  bool debugVerify() const;
906 
910  void handleAsyncInsertions();
911 
927  virtual void wakeup(Tick when = (Tick)-1) { }
928 
938 
951  void lock() { service_mutex.lock(); }
967 
968  virtual ~EventQueue()
969  {
970  while (!empty())
971  deschedule(getHead());
972  }
973 };
974 
975 inline void
977 {
978  _curEventQueue = q;
979  Gem5Internal::_curTickPtr = (q == nullptr) ? nullptr : &q->_curTick;
980 }
981 
982 void dumpMainQueue();
983 
985 {
986  protected:
989 
990  public:
1000  EventManager(EventQueue *eq) : eventq(eq) {} //end of api_eventq group
1002 
1006  EventQueue *
1007  eventQueue() const
1008  {
1009  return eventq;
1010  }
1011 
1015  void
1017  {
1018  eventq->schedule(&event, when);
1019  }
1020 
1024  void
1026  {
1027  eventq->deschedule(&event);
1028  }
1029 
1033  void
1034  reschedule(Event &event, Tick when, bool always = false)
1035  {
1036  eventq->reschedule(&event, when, always);
1037  }
1038 
1042  void
1044  {
1045  eventq->schedule(event, when);
1046  }
1047 
1051  void
1053  {
1055  }
1056 
1060  void
1061  reschedule(Event *event, Tick when, bool always = false)
1062  {
1063  eventq->reschedule(event, when, always);
1064  }
1065 
1072  void wakeupEventQueue(Tick when = (Tick)-1)
1073  {
1074  eventq->wakeup(when);
1075  }
1076 
1077  void setCurTick(Tick newVal) { eventq->setCurTick(newVal); }
1078 };
1079 
1080 template <class T, void (T::* F)()>
1081 class EventWrapper : public Event
1082 {
1083  private:
1085 
1086  public:
1087  EventWrapper(T *obj, bool del = false, Priority p = Default_Pri)
1088  : Event(p), object(obj)
1089  {
1090  if (del)
1092  }
1093 
1094  EventWrapper(T &obj, bool del = false, Priority p = Default_Pri)
1095  : Event(p), object(&obj)
1096  {
1097  if (del)
1099  }
1100 
1101  void process() { (object->*F)(); }
1102 
1103  const std::string
1104  name() const
1105  {
1106  return object->name() + ".wrapped_event";
1107  }
1108 
1109  const char *description() const { return "EventWrapped"; }
1110 };
1111 
1113 {
1114  private:
1115  std::function<void(void)> callback;
1116  std::string _name;
1117 
1118  public:
1125  EventFunctionWrapper(const std::function<void(void)> &callback,
1126  const std::string &name,
1127  bool del = false,
1130  {
1131  if (del)
1133  }
1134 
1138  void process() { callback(); }
1139 
1143  const std::string
1144  name() const
1145  {
1146  return _name + ".wrapped_function_event";
1147  }
1148 
1152  const char *description() const { return "EventFunctionWrapped"; }
1153 };
1154 
1155 #endif // __SIM_EVENTQ_HH__
EventWrapper::EventWrapper
EventWrapper(T *obj, bool del=false, Priority p=Default_Pri)
Definition: eventq.hh:1087
EventWrapper::description
const char * description() const
Return a C string describing the event.
Definition: eventq.hh:1109
EventQueue::ScopedMigration::~ScopedMigration
~ScopedMigration()
Definition: eventq.hh:697
Event::_priority
Priority _priority
event priority
Definition: eventq.hh:269
Event::scheduled
bool scheduled() const
Determine if the current event is scheduled.
Definition: eventq.hh:462
EventBase::AutoDelete
static const FlagsType AutoDelete
Definition: eventq.hh:104
EventQueue::debugVerify
bool debugVerify() const
Definition: eventq.cc:312
Event::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: eventq.cc:246
Event::nextBin
Event * nextBin
Definition: eventq.hh:262
EventQueue::ScopedMigration::ScopedMigration
ScopedMigration(EventQueue *_new_eq, bool _doMigrate=true)
Temporarily migrate execution to a different event queue.
Definition: eventq.hh:686
EventQueue::ScopedMigration::doMigrate
bool doMigrate
Definition: eventq.hh:709
EventQueue::name
virtual const std::string name() const
Definition: eventq.hh:751
EventQueue::serviceOne
Event * serviceOne()
Definition: eventq.cc:196
EventWrapper::EventWrapper
EventWrapper(T &obj, bool del=false, Priority p=Default_Pri)
Definition: eventq.hh:1094
Event::instance
Counter instance
This event's unique ID.
Definition: eventq.hh:280
EventQueue::unlock
void unlock()
Definition: eventq.hh:952
Event::insertBefore
static Event * insertBefore(Event *event, Event *curr)
Definition: eventq.cc:89
EventQueue::reschedule
void reschedule(Event *event, Tick when, bool always=false)
Reschedule the specified event.
Definition: eventq.hh:818
EventBase::CPU_Tick_Pri
static const Priority CPU_Tick_Pri
CPU ticks must come after other associated CPU events (such as writebacks).
Definition: eventq.hh:201
MipsISA::index
Bitfield< 30, 0 > index
Definition: pra_constants.hh:44
serialize.hh
EventManager::reschedule
void reschedule(Event *event, Tick when, bool always=false)
Definition: eventq.hh:1061
EventBase::Stat_Event_Pri
static const Priority Stat_Event_Pri
Statistics events (dump, reset, etc.) come after everything else, but before exit.
Definition: eventq.hh:216
Event::_when
Tick _when
timestamp when event should be processed
Definition: eventq.hh:268
EventQueue::checkpointReschedule
void checkpointReschedule(Event *event)
Reschedule an event after a checkpoint.
Definition: eventq.cc:278
EventBase::InitMask
static const FlagsType InitMask
Definition: eventq.hh:114
Event::isExitEvent
bool isExitEvent() const
See if this is a SimExitEvent (without resorting to RTTI)
Definition: eventq.hh:483
Event::squashed
bool squashed() const
Check whether the event is squashed.
Definition: eventq.hh:476
EventManager::reschedule
void reschedule(Event &event, Tick when, bool always=false)
Definition: eventq.hh:1034
EventBase::Scheduled
static const FlagsType Scheduled
Definition: eventq.hh:102
EventQueue::replaceHead
Event * replaceHead(Event *s)
function for replacing the head of the event queue, so that a different set of events can run without...
Definition: eventq.cc:354
Event::setWhen
void setWhen(Tick when, EventQueue *q)
Definition: eventq.hh:293
EventManager::schedule
void schedule(Event *event, Tick when)
Definition: eventq.hh:1043
Flags< FlagsType >
EventQueue::async_queue
std::list< Event * > async_queue
List of events added by other threads to this event queue.
Definition: eventq.hh:632
operator==
bool operator==(const Event &l, const Event &r)
Definition: eventq.hh:567
Serializable
Basic support for object serialization.
Definition: serialize.hh:175
Event::acquireImpl
virtual void acquireImpl()
Definition: eventq.hh:394
EventQueue::ScopedRelease::eq
EventQueue & eq
Definition: eventq.hh:739
EventWrapper
Definition: eventq.hh:1081
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:59
ArmISA::q
Bitfield< 27 > q
Definition: miscregs_types.hh:52
numMainEventQueues
uint32_t numMainEventQueues
Current number of allocated main event queues.
Definition: eventq.cc:54
Event::dump
void dump() const
Dump the current event data.
Definition: eventq.cc:403
operator!=
bool operator!=(const Event &l, const Event &r)
Definition: eventq.hh:576
EventQueue::getHead
Event * getHead() const
Definition: eventq.hh:855
operator<=
bool operator<=(const Event &l, const Event &r)
Definition: eventq.hh:547
DTRACE
#define DTRACE(x)
Definition: debug.hh:156
EventBase::IsExitEvent
static const FlagsType IsExitEvent
Definition: eventq.hh:111
EventManager::deschedule
void deschedule(Event &event)
Definition: eventq.hh:1025
std::vector
STL vector class.
Definition: stl.hh:37
EventQueue::dump
void dump() const
This is a debugging function which will print everything on the event queue.
Definition: eventq.cc:287
Event::flags
Flags flags
Definition: eventq.hh:270
Event::description
virtual const char * description() const
Return a C string describing the event.
Definition: eventq.cc:371
EventBase::IsMainQueue
static const FlagsType IsMainQueue
Definition: eventq.hh:112
EventQueue::wakeup
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...
Definition: eventq.hh:927
Event::when
Tick when() const
Get the time that the event is scheduled.
Definition: eventq.hh:505
EventQueue::service_mutex
UncontendedMutex service_mutex
Lock protecting event handling.
Definition: eventq.hh:654
getEventQueue
EventQueue * getEventQueue(uint32_t index)
Function for returning eventq queue for the provided index.
Definition: eventq.cc:60
EventBase::Delayed_Writeback_Pri
static const Priority Delayed_Writeback_Pri
For some reason "delayed" inter-cluster writebacks are scheduled before regular writebacks (which hav...
Definition: eventq.hh:169
operator<
bool operator<(const Event &l, const Event &r)
Definition: eventq.hh:527
EventQueue::_curTick
Tick _curTick
Definition: eventq.hh:626
simQuantum
Tick simQuantum
Simulation Quantum for multiple eventq simulation.
Definition: eventq.cc:46
EventQueue::ScopedRelease
Definition: eventq.hh:713
Event::process
virtual void process()=0
EventQueue::ScopedMigration::new_eq
EventQueue & new_eq
Definition: eventq.hh:707
Flags::noneSet
bool noneSet(Type mask) const
Verifies whether no bits matching the given mask are set.
Definition: flags.hh:96
EventQueue::ScopedRelease::ScopedRelease
ScopedRelease(EventQueue *_eq)
Temporarily release the event queue service lock.
Definition: eventq.hh:727
EventQueue::nextTick
Tick nextTick() const
Definition: eventq.hh:840
EventQueue::getCurTick
Tick getCurTick() const
While curTick() is useful for any object assigned to this event queue, if an object that is assigned ...
Definition: eventq.hh:854
EventFunctionWrapper
Definition: eventq.hh:1112
EventBase::PublicRead
static const FlagsType PublicRead
Definition: eventq.hh:99
EventQueue::name
void name(const std::string &st)
Definition: eventq.hh:752
EventBase::Managed
static const FlagsType Managed
Definition: eventq.hh:103
ArmISA::n
Bitfield< 31 > n
Definition: miscregs_types.hh:450
EventBase::Flags
::Flags< FlagsType > Flags
Definition: eventq.hh:97
UncontendedMutex::lock
void lock()
Definition: uncontended_mutex.hh:67
EventBase::CPU_Exit_Pri
static const Priority CPU_Exit_Pri
If we want to exit a thread in a CPU, it comes after CPU_Tick_Pri.
Definition: eventq.hh:208
Counter
int64_t Counter
Statistics counter type.
Definition: types.hh:54
cp
Definition: cprintf.cc:37
EventManager::schedule
void schedule(Event &event, Tick when)
Definition: eventq.hh:1016
EventBase::Sim_Exit_Pri
static const Priority Sim_Exit_Pri
If we want to exit on this cycle, it's the very last thing we do.
Definition: eventq.hh:231
Event::acquire
void acquire()
Memory management hooks for events that have the Managed flag set.
Definition: eventq.hh:380
EventBase::Minimum_Pri
static const Priority Minimum_Pri
Event priorities, to provide tie-breakers for events scheduled at the same cycle.
Definition: eventq.hh:132
operator>
bool operator>(const Event &l, const Event &r)
Definition: eventq.hh:537
Flags::clear
void clear()
Clear all flag's bits.
Definition: flags.hh:99
Event
Definition: eventq.hh:248
EventBase::Reserved0
static const FlagsType Reserved0
This used to be AutoSerialize.
Definition: eventq.hh:110
EventFunctionWrapper::EventFunctionWrapper
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.
Definition: eventq.hh:1125
EventManager::EventManager
EventManager(EventQueue *eq)
Definition: eventq.hh:1000
Event::clearFlags
void clearFlags()
Definition: eventq.hh:339
EventBase::FlagsType
unsigned short FlagsType
Definition: eventq.hh:96
EventQueue::ScopedRelease::~ScopedRelease
~ScopedRelease()
Definition: eventq.hh:733
Event::nextInBin
Event * nextInBin
Definition: eventq.hh:263
EventManager::setCurTick
void setCurTick(Tick newVal)
Definition: eventq.hh:1077
EventQueue::curEventQueue
friend void curEventQueue(EventQueue *)
Definition: eventq.hh:976
MipsISA::event
Bitfield< 10, 5 > event
Definition: pra_constants.hh:297
EventBase::DVFS_Update_Pri
static const Priority DVFS_Update_Pri
DVFS update event leads to stats dump therefore given a lower priority to ensure all relevant states ...
Definition: eventq.hh:184
ArmISA::st
Bitfield< 31, 28 > st
Definition: miscregs_types.hh:152
EventQueue::empty
bool empty() const
Returns true if no events are queued.
Definition: eventq.hh:895
MipsISA::r
r
Definition: pra_constants.hh:95
EventQueue::serviceEvents
void serviceEvents(Tick when)
process all events up to the given timestamp.
Definition: eventq.hh:873
inParallelMode
bool inParallelMode
Current mode of execution: parallel / serial.
Definition: eventq.cc:57
Event::setFlags
void setFlags(Flags _flags)
Definition: eventq.hh:325
Event::isManaged
bool isManaged() const
Check whether this event will auto-delete.
Definition: eventq.hh:490
EventQueue::handleAsyncInsertions
void handleAsyncInsertions()
Function for moving events from the async_queue to the main queue.
Definition: eventq.cc:434
EventBase::Debug_Enable_Pri
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...
Definition: eventq.hh:141
debug.hh
EventWrapper::object
T * object
Definition: eventq.hh:1084
Flags::set
void set(Type mask)
Set all flag's bits matching the given mask.
Definition: flags.hh:113
Event::trace
virtual void trace(const char *action)
This function isn't really useful if TRACING_ON is not defined.
Definition: eventq.cc:377
Event::initialized
bool initialized() const
Definition: eventq.hh:305
X86ISA::em
Bitfield< 2 > em
Definition: misc.hh:602
curEventQueue
EventQueue * curEventQueue()
Definition: eventq.hh:85
EventBase::Maximum_Pri
static const Priority Maximum_Pri
Maximum priority.
Definition: eventq.hh:238
Event::isFlagSet
bool isFlagSet(Flags _flags) const
Definition: eventq.hh:318
EventQueue::asyncInsert
void asyncInsert(Event *event)
Function for adding events to the async queue.
Definition: eventq.cc:426
EventBase::Serialize_Pri
static const Priority Serialize_Pri
Serailization needs to occur before tick events also, so that a serialize/unserialize is identical to...
Definition: eventq.hh:193
Event::instanceString
const std::string instanceString() const
Return the instance number as a string.
Definition: eventq.cc:393
Event::priority
Priority priority() const
Get the event priority.
Definition: eventq.hh:512
EventBase::PublicWrite
static const FlagsType PublicWrite
Definition: eventq.hh:100
EventQueue::~EventQueue
virtual ~EventQueue()
Definition: eventq.hh:968
Flags::isSet
bool isSet(Type mask) const
Verifies whether any bit matching the given mask is set.
Definition: flags.hh:80
EventQueue::setCurTick
void setCurTick(Tick newVal)
Definition: eventq.hh:841
EventQueue::insert
void insert(Event *event)
Insert / remove event from the queue.
Definition: eventq.cc:110
core.hh
EventManager::eventQueue
EventQueue * eventQueue() const
Definition: eventq.hh:1007
Event::clearFlags
void clearFlags(Flags _flags)
Definition: eventq.hh:332
Event::globalEvent
virtual BaseGlobalEvent * globalEvent()
If this is part of a GlobalEvent, return the pointer to the Global Event.
Definition: eventq.hh:517
EventBase::Debug_Break_Pri
static const Priority Debug_Break_Pri
Breakpoints should happen before anything else (except enabling trace output), so we don't miss any a...
Definition: eventq.hh:150
flags.hh
uncontended_mutex.hh
Event::releaseImpl
virtual void releaseImpl()
Definition: eventq.hh:396
EventFunctionWrapper::process
void process()
Definition: eventq.hh:1138
EventFunctionWrapper::description
const char * description() const
Return a C string describing the event.
Definition: eventq.hh:1152
EventQueue::schedule
void schedule(Event *event, Tick when, bool global=false)
Schedule the given event on this queue.
Definition: eventq.hh:761
EventQueue::lock
void lock()
Provide an interface for locking/unlocking the event queue.
Definition: eventq.hh:951
Event::release
void release()
Managed event removed from the event queue.
Definition: eventq.hh:389
EventQueue::ScopedMigration
Definition: eventq.hh:669
EventQueue::objName
std::string objName
Definition: eventq.hh:624
Event::isAutoDelete
bool isAutoDelete() const
The function returns true if the object is automatically deleted after the event is processed.
Definition: eventq.hh:498
PowerISA::eq
Bitfield< 29 > eq
Definition: miscregs.hh:48
EventBase::CPU_Switch_Pri
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...
Definition: eventq.hh:160
Event::getFlags
Flags getFlags() const
Definition: eventq.hh:312
types.hh
EventQueue::remove
void remove(Event *event)
Definition: eventq.cc:164
UncontendedMutex::unlock
void unlock()
Definition: uncontended_mutex.hh:92
operator>=
bool operator>=(const Event &l, const Event &r)
Definition: eventq.hh:557
EventQueue::deschedule
void deschedule(Event *event)
Deschedule the specified event.
Definition: eventq.hh:794
EventBase::Default_Pri
static const Priority Default_Pri
Default is zero for historical reasons.
Definition: eventq.hh:176
EventManager::eventq
EventQueue * eventq
A pointer to this object's event queue.
Definition: eventq.hh:988
Event::squash
void squash()
Squash the current event.
Definition: eventq.hh:469
Event::removeItem
static Event * removeItem(Event *event, Event *last)
Definition: eventq.cc:133
EventManager::deschedule
void deschedule(Event *event)
Definition: eventq.hh:1052
EventBase
Common base class for Event and GlobalEvent, so they can share flag and priority definitions and acce...
Definition: eventq.hh:93
EventManager::wakeupEventQueue
void wakeupEventQueue(Tick when=(Tick) -1)
This function is not needed by the usual gem5 event loop but may be necessary in derived EventQueues ...
Definition: eventq.hh:1072
CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:64
EventBase::Squashed
static const FlagsType Squashed
Definition: eventq.hh:101
EventQueue::async_queue_mutex
UncontendedMutex async_queue_mutex
Mutex to protect async queue.
Definition: eventq.hh:629
EventWrapper::process
void process()
Definition: eventq.hh:1101
EventManager
Definition: eventq.hh:984
EventQueue::ScopedMigration::old_eq
EventQueue & old_eq
Definition: eventq.hh:708
curTick
Tick curTick()
The universal simulation clock.
Definition: cur_tick.hh:43
EventFunctionWrapper::_name
std::string _name
Definition: eventq.hh:1116
Gem5Internal::_curTickPtr
__thread Tick * _curTickPtr
Definition: cur_tick.cc:34
Event::Event
Event(Priority p=Default_Pri, Flags f=0)
Definition: eventq.hh:411
EventBase::Priority
int8_t Priority
Definition: eventq.hh:120
EventQueue
Queue of events sorted in time order.
Definition: eventq.hh:619
UncontendedMutex
Definition: uncontended_mutex.hh:44
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
std::list< Event * >
EventQueue::EventQueue
EventQueue(const EventQueue &)
EventBase::Progress_Event_Pri
static const Priority Progress_Event_Pri
Progress events come at the end.
Definition: eventq.hh:223
EventFunctionWrapper::name
const std::string name() const
Definition: eventq.hh:1144
ArmISA::s
Bitfield< 4 > s
Definition: miscregs_types.hh:556
EventManager::EventManager
EventManager(EventManager *em)
Definition: eventq.hh:999
CheckpointIn
Definition: serialize.hh:68
MipsISA::l
Bitfield< 5 > l
Definition: pra_constants.hh:320
Event::name
virtual const std::string name() const
Definition: eventq.cc:82
EventFunctionWrapper::callback
std::function< void(void)> callback
Definition: eventq.hh:1115
BaseGlobalEvent
Common base class for GlobalEvent and GlobalSyncEvent.
Definition: global_event.hh:60
EventWrapper::name
const std::string name() const
Definition: eventq.hh:1104
dumpMainQueue
void dumpMainQueue()
Definition: eventq.cc:362
EventQueue::head
Event * head
Definition: eventq.hh:625
mainEventQueue
std::vector< EventQueue * > mainEventQueue
Array for main event queues.
Definition: eventq.cc:55
Event::~Event
virtual ~Event()
Definition: eventq.cc:75
EventBase::Initialized
static const FlagsType Initialized
Definition: eventq.hh:113
Event::instanceCounter
static Counter instanceCounter
Global counter to generate unique IDs for Event instances.
Definition: eventq.hh:274
Event::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: eventq.cc:237
ArmISA::f
Bitfield< 6 > f
Definition: miscregs_types.hh:64
EventManager::EventManager
EventManager(EventManager &em)
Event manger manages events in the event queue.
Definition: eventq.hh:998
_curEventQueue
__thread EventQueue * _curEventQueue
The current event queue for the running thread.
Definition: eventq.cc:56
Event::queue
EventQueue * queue
queue to which this event belongs (though it may or may not be scheduled on this queue yet)
Definition: eventq.hh:284

Generated on Tue Jun 22 2021 15:28:30 for gem5 by doxygen 1.8.17