gem5  [DEVELOP-FOR-23.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/named.hh"
50 #include "base/trace.hh"
51 #include "base/type_traits.hh"
52 #include "base/types.hh"
54 #include "debug/Event.hh"
55 #include "sim/cur_tick.hh"
56 #include "sim/serialize.hh"
57 
58 namespace gem5
59 {
60 
61 class EventQueue; // forward declaration
62 class BaseGlobalEvent;
63 
69 extern Tick simQuantum;
70 
72 extern uint32_t numMainEventQueues;
73 
76 
79 
80 extern __thread EventQueue *_curEventQueue;
81 
83 extern bool inParallelMode;
84 
89 EventQueue *getEventQueue(uint32_t index);
90 
92 inline void curEventQueue(EventQueue *q);
93 
99 class EventBase
100 {
101  protected:
102  typedef unsigned short FlagsType;
103  typedef ::gem5::Flags<FlagsType> Flags;
104 
105  static const FlagsType PublicRead = 0x003f; // public readable flags
106  static const FlagsType PublicWrite = 0x001d; // public writable flags
107  static const FlagsType Squashed = 0x0001; // has been squashed
108  static const FlagsType Scheduled = 0x0002; // has been scheduled
109  static const FlagsType Managed = 0x0004; // Use life cycle manager
110  static const FlagsType AutoDelete = Managed; // delete after dispatch
116  static const FlagsType Reserved0 = 0x0008;
117  static const FlagsType IsExitEvent = 0x0010; // special exit event
118  static const FlagsType IsMainQueue = 0x0020; // on main event queue
119  static const FlagsType Initialized = 0x7a40; // somewhat random bits
120  static const FlagsType InitMask = 0xffc0; // mask for init bits
121 
122  public:
126  typedef int8_t Priority;
127 
132 
138  static const Priority Minimum_Pri = SCHAR_MIN;
139 
147  static const Priority Debug_Enable_Pri = -101;
148 
156  static const Priority Debug_Break_Pri = -100;
157 
166  static const Priority CPU_Switch_Pri = -31;
167 
175  static const Priority Delayed_Writeback_Pri = -1;
176 
182  static const Priority Default_Pri = 0;
183 
190  static const Priority DVFS_Update_Pri = 31;
191 
199  static const Priority Serialize_Pri = 32;
200 
207  static const Priority CPU_Tick_Pri = 50;
208 
214  static const Priority CPU_Exit_Pri = 64;
215 
222  static const Priority Stat_Event_Pri = 90;
223 
229  static const Priority Progress_Event_Pri = 95;
230 
237  static const Priority Sim_Exit_Pri = 100;
238 
244  static const Priority Maximum_Pri = SCHAR_MAX;
245 };
246 
247 /*
248  * An item on an event queue. The action caused by a given
249  * event is specified by deriving a subclass and overriding the
250  * process() member function.
251  *
252  * Caution, the order of members is chosen to maximize data packing.
253  */
254 class Event : public EventBase, public Serializable
255 {
256  friend class EventQueue;
257 
258  private:
259  // The event queue is now a linked list of linked lists. The
260  // 'nextBin' pointer is to find the bin, where a bin is defined as
261  // when+priority. All events in the same bin will be stored in a
262  // second linked list (a stack) maintained by the 'nextInBin'
263  // pointer. The list will be accessed in LIFO order. The end
264  // result is that the insert/removal in 'nextBin' is
265  // linear/constant, and the lookup/removal in 'nextInBin' is
266  // constant/constant. Hopefully this is a significant improvement
267  // over the current fully linear insertion.
270 
271  static Event *insertBefore(Event *event, Event *curr);
272  static Event *removeItem(Event *event, Event *last);
273 
277 
278 #ifndef NDEBUG
279  static Counter instanceCounter;
281 
287 
291 #endif
292 
293 #ifdef EVENTQ_DEBUG
294  Tick whenCreated;
295  Tick whenScheduled;
296 #endif
297 
298  void
300  {
301  _when = when;
302 #ifndef NDEBUG
303  queue = q;
304 #endif
305 #ifdef EVENTQ_DEBUG
306  whenScheduled = curTick();
307 #endif
308  }
309 
310  bool
311  initialized() const
312  {
313  return (flags & InitMask) == Initialized;
314  }
315 
316  protected:
317  Flags
318  getFlags() const
319  {
320  return flags & PublicRead;
321  }
322 
323  bool
324  isFlagSet(Flags _flags) const
325  {
326  assert(_flags.noneSet(~PublicRead));
327  return flags.isSet(_flags);
328  }
329 
330  void
331  setFlags(Flags _flags)
332  {
333  assert(_flags.noneSet(~PublicWrite));
334  flags.set(_flags);
335  }
336 
337  void
339  {
340  assert(_flags.noneSet(~PublicWrite));
341  flags.clear(_flags);
342  }
343 
344  void
346  {
348  }
349 
355  virtual void trace(const char *action);
356 
358  const std::string instanceString() const;
359 
360  protected: /* Memory management */
386  void acquire();
387 
391  void release();
392 
393  virtual void acquireImpl();
394 
395  virtual void releaseImpl();
396 
399  public:
400 
401  /*
402  * Event constructor
403  * @param queue that the event gets scheduled on
404  *
405  * @ingroup api_eventq
406  */
408  : nextBin(nullptr), nextInBin(nullptr), _when(0), _priority(p),
409  flags(Initialized | f)
410  {
411  assert(f.noneSet(~PublicWrite));
412 #ifndef NDEBUG
414  queue = NULL;
415 #endif
416 #ifdef EVENTQ_DEBUG
417  whenCreated = curTick();
418  whenScheduled = 0;
419 #endif
420  }
421 
426  virtual ~Event();
427  virtual const std::string name() const;
428 
432  virtual const char *description() const;
433 
435  void dump() const; //end of api group
437 
438  public:
439  /*
440  * This member function is invoked when the event is processed
441  * (occurs). There is no default implementation; each subclass
442  * must provide its own implementation. The event is not
443  * automatically deleted after it is processed (to allow for
444  * statically allocated event objects).
445  *
446  * If the AutoDestroy flag is set, the object is deleted once it
447  * is processed.
448  *
449  * @ingroup api_eventq
450  */
451  virtual void process() = 0;
452 
458  bool scheduled() const { return flags.isSet(Scheduled); }
459 
465  void squash() { flags.set(Squashed); }
466 
472  bool squashed() const { return flags.isSet(Squashed); }
473 
479  bool isExitEvent() const { return flags.isSet(IsExitEvent); }
480 
486  bool isManaged() const { return flags.isSet(Managed); }
487 
494  bool isAutoDelete() const { return isManaged(); }
495 
501  Tick when() const { return _when; }
502 
508  Priority priority() const { return _priority; }
509 
513  virtual BaseGlobalEvent *globalEvent() { return NULL; }
514 
515  void serialize(CheckpointOut &cp) const override;
516  void unserialize(CheckpointIn &cp) override;
517 };
518 
522 inline bool
523 operator<(const Event &l, const Event &r)
524 {
525  return l.when() < r.when() ||
526  (l.when() == r.when() && l.priority() < r.priority());
527 }
528 
532 inline bool
533 operator>(const Event &l, const Event &r)
534 {
535  return l.when() > r.when() ||
536  (l.when() == r.when() && l.priority() > r.priority());
537 }
538 
542 inline bool
543 operator<=(const Event &l, const Event &r)
544 {
545  return l.when() < r.when() ||
546  (l.when() == r.when() && l.priority() <= r.priority());
547 }
548 
552 inline bool
553 operator>=(const Event &l, const Event &r)
554 {
555  return l.when() > r.when() ||
556  (l.when() == r.when() && l.priority() >= r.priority());
557 }
558 
562 inline bool
563 operator==(const Event &l, const Event &r)
564 {
565  return l.when() == r.when() && l.priority() == r.priority();
566 }
567 
571 inline bool
572 operator!=(const Event &l, const Event &r)
573 {
574  return l.when() != r.when() || l.priority() != r.priority();
575 }
576 
616 {
617  private:
618  friend void curEventQueue(EventQueue *);
619 
620  std::string objName;
623 
626 
629 
651 
654  void insert(Event *event);
655  void remove(Event *event);
656 
660  void asyncInsert(Event *event);
661 
662  EventQueue(const EventQueue &);
663 
664  public:
666  {
667  public:
682  ScopedMigration(EventQueue *_new_eq, bool _doMigrate = true)
683  :new_eq(*_new_eq), old_eq(*curEventQueue()),
684  doMigrate((&new_eq != &old_eq)&&_doMigrate)
685  {
686  if (doMigrate){
687  old_eq.unlock();
688  new_eq.lock();
690  }
691  }
692 
694  {
695  if (doMigrate){
696  new_eq.unlock();
697  old_eq.lock();
699  }
700  }
701 
702  private:
705  bool doMigrate;
706  };
707 
708 
710  {
711  public:
724  : eq(*_eq)
725  {
726  eq.unlock();
727  }
728 
730  {
731  eq.lock();
732  }
733 
734  private:
736  };
737 
741  EventQueue(const std::string &n);
742 
747  virtual const std::string name() const { return objName; }
748  void name(const std::string &st) { objName = st; } //end of api_eventq group
750 
756  void
757  schedule(Event *event, Tick when, bool global=false)
758  {
759  assert(when >= getCurTick());
760  assert(!event->scheduled());
761  assert(event->initialized());
762 
763  event->setWhen(when, this);
764 
765  // The check below is to make sure of two things
766  // a. A thread schedules local events on other queues through the
767  // asyncq.
768  // b. A thread schedules global events on the asyncq, whether or not
769  // this event belongs to this eventq. This is required to maintain
770  // a total order amongst the global events. See global_event.{cc,hh}
771  // for more explanation.
772  if (inParallelMode && (this != curEventQueue() || global)) {
774  } else {
775  insert(event);
776  }
777  event->flags.set(Event::Scheduled);
778  event->acquire();
779 
780  if (debug::Event)
781  event->trace("scheduled");
782  }
783 
789  void
791  {
792  assert(event->scheduled());
793  assert(event->initialized());
794  assert(!inParallelMode || this == curEventQueue());
795 
796  remove(event);
797 
798  event->flags.clear(Event::Squashed);
799  event->flags.clear(Event::Scheduled);
800 
801  if (debug::Event)
802  event->trace("descheduled");
803 
804  event->release();
805  }
806 
813  void
814  reschedule(Event *event, Tick when, bool always=false)
815  {
816  assert(when >= getCurTick());
817  assert(always || event->scheduled());
818  assert(event->initialized());
819  assert(!inParallelMode || this == curEventQueue());
820 
821  if (event->scheduled()) {
822  remove(event);
823  } else {
824  event->acquire();
825  }
826 
827  event->setWhen(when, this);
828  insert(event);
829  event->flags.clear(Event::Squashed);
830  event->flags.set(Event::Scheduled);
831 
832  if (debug::Event)
833  event->trace("rescheduled");
834  }
835 
836  Tick nextTick() const { return head->when(); }
837  void setCurTick(Tick newVal) { _curTick = newVal; }
838 
850  Tick getCurTick() const { return _curTick; }
851  Event *getHead() const { return head; }
852 
853  Event *serviceOne();
854 
868  void
870  {
871  while (!empty()) {
872  if (nextTick() > when)
873  break;
874 
879  //assert(head->when() >= when && "event scheduled in the past");
880  serviceOne();
881  }
882 
883  setCurTick(when);
884  }
885 
891  bool empty() const { return head == NULL; }
892 
899  void dump() const;
900 
901  bool debugVerify() const;
902 
906  void handleAsyncInsertions();
907 
923  virtual void wakeup(Tick when = (Tick)-1) { }
924 
934 
947  void lock() { service_mutex.lock(); }
963 
964  virtual ~EventQueue()
965  {
966  while (!empty())
967  deschedule(getHead());
968  }
969 };
970 
971 inline void
973 {
974  _curEventQueue = q;
975  Gem5Internal::_curTickPtr = (q == nullptr) ? nullptr : &q->_curTick;
976 }
977 
978 void dumpMainQueue();
979 
981 {
982  protected:
985 
986  public:
996  EventManager(EventQueue *eq) : eventq(eq) {} //end of api_eventq group
998 
1002  EventQueue *
1003  eventQueue() const
1004  {
1005  return eventq;
1006  }
1007 
1011  void
1013  {
1014  eventq->schedule(&event, when);
1015  }
1016 
1020  void
1022  {
1023  eventq->deschedule(&event);
1024  }
1025 
1029  void
1030  reschedule(Event &event, Tick when, bool always = false)
1031  {
1032  eventq->reschedule(&event, when, always);
1033  }
1034 
1038  void
1040  {
1041  eventq->schedule(event, when);
1042  }
1043 
1047  void
1049  {
1051  }
1052 
1056  void
1057  reschedule(Event *event, Tick when, bool always = false)
1058  {
1059  eventq->reschedule(event, when, always);
1060  }
1061 
1068  void wakeupEventQueue(Tick when = (Tick)-1)
1069  {
1070  eventq->wakeup(when);
1071  }
1072 
1073  void setCurTick(Tick newVal) { eventq->setCurTick(newVal); }
1074 };
1075 
1090 template <auto F>
1091 class MemberEventWrapper final: public Event, public Named
1092 {
1094  static_assert(std::is_same_v<void, MemberFunctionReturn_t<F>>);
1095  static_assert(std::is_same_v<MemberFunctionArgsTuple_t<F>, std::tuple<>>);
1096 
1097 public:
1098  [[deprecated("Use reference version of this constructor instead")]]
1100  bool del = false,
1101  Priority p = Default_Pri):
1102  MemberEventWrapper{*object, del, p}
1103  {}
1104 
1113  bool del = false,
1114  Priority p = Default_Pri):
1115  Event(p),
1116  Named(object.name() + ".wrapped_event"),
1117  mObject(&object)
1118  {
1119  if (del) setFlags(AutoDelete);
1121  }
1122 
1123  void process() override {
1124  (mObject->*F)();
1125  }
1126 
1127  const char *description() const override { return "EventWrapped"; }
1128 private:
1130 };
1131 
1132 template <class T, void (T::* F)()>
1133 using EventWrapper [[deprecated("Use MemberEventWrapper instead")]]
1135 
1137 {
1138  private:
1139  std::function<void(void)> callback;
1140  std::string _name;
1141 
1142  public:
1149  EventFunctionWrapper(const std::function<void(void)> &callback,
1150  const std::string &name,
1151  bool del = false,
1154  {
1155  if (del)
1157  }
1158 
1162  void process() { callback(); }
1163 
1167  const std::string
1168  name() const
1169  {
1170  return _name + ".wrapped_function_event";
1171  }
1172 
1176  const char *description() const { return "EventFunctionWrapped"; }
1177 };
1178 
1184 #define SERIALIZE_EVENT(event) event.serializeSection(cp, #event);
1185 
1191 #define UNSERIALIZE_EVENT(event) \
1192  do { \
1193  event.unserializeSection(cp, #event); \
1194  eventQueue()->checkpointReschedule(&event); \
1195  } while (0)
1196 
1197 } // namespace gem5
1198 
1199 #endif // __SIM_EVENTQ_HH__
gem5::EventQueue::name
void name(const std::string &st)
Definition: eventq.hh:748
gem5::curTick
Tick curTick()
The universal simulation clock.
Definition: cur_tick.hh:46
gem5::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:1149
gem5::EventQueue::_curTick
Tick _curTick
Definition: eventq.hh:622
gem5::EventBase::Flags
::gem5::Flags< FlagsType > Flags
Definition: eventq.hh:103
gem5::EventQueue::ScopedMigration::new_eq
EventQueue & new_eq
Definition: eventq.hh:703
gem5::VegaISA::s
Bitfield< 1 > s
Definition: pagetable.hh:64
gem5::EventManager::EventManager
EventManager(EventManager &em)
Event manger manages events in the event queue.
Definition: eventq.hh:994
gem5::Event::isExitEvent
bool isExitEvent() const
See if this is a SimExitEvent (without resorting to RTTI)
Definition: eventq.hh:479
gem5::VegaISA::f
Bitfield< 56 > f
Definition: pagetable.hh:53
gem5::Event::description
virtual const char * description() const
Return a C string describing the event.
Definition: eventq.cc:399
gem5::Event::isManaged
bool isManaged() const
Check whether this event will auto-delete.
Definition: eventq.hh:486
gem5::Event::when
Tick when() const
Get the time that the event is scheduled.
Definition: eventq.hh:501
gem5::operator>=
bool operator>=(const Time &l, const Time &r)
Definition: time.hh:240
gem5::EventQueue::ScopedRelease
Definition: eventq.hh:709
gem5::EventQueue::~EventQueue
virtual ~EventQueue()
Definition: eventq.hh:964
gem5::Event::name
virtual const std::string name() const
Definition: eventq.cc:84
gem5::EventFunctionWrapper::_name
std::string _name
Definition: eventq.hh:1140
gem5::UncontendedMutex
Definition: uncontended_mutex.hh:47
gem5::Event::clearFlags
void clearFlags()
Definition: eventq.hh:345
gem5::UncontendedMutex::lock
void lock()
Definition: uncontended_mutex.hh:70
gem5::MemberEventWrapper::process
void process() override
Definition: eventq.hh:1123
gem5::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:382
gem5::EventManager::eventQueue
EventQueue * eventQueue() const
Definition: eventq.hh:1003
serialize.hh
gem5::EventQueue::objName
std::string objName
Definition: eventq.hh:620
gem5::MemberEventWrapper::MemberEventWrapper
MemberEventWrapper(CLASS *object, bool del=false, Priority p=Default_Pri)
Definition: eventq.hh:1099
gem5::Event::nextInBin
Event * nextInBin
Definition: eventq.hh:269
gem5::MipsISA::index
Bitfield< 30, 0 > index
Definition: pra_constants.hh:47
gem5::EventBase::Reserved0
static const FlagsType Reserved0
This used to be AutoSerialize.
Definition: eventq.hh:116
gem5::mainEventQueue
std::vector< EventQueue * > mainEventQueue
Array for main event queues.
Definition: eventq.cc:57
gem5::Event::Event
Event(Priority p=Default_Pri, Flags f=0)
Definition: eventq.hh:407
gem5::EventQueue::unlock
void unlock()
Definition: eventq.hh:948
gem5::Flags::set
void set(Type mask)
Set all flag's bits matching the given mask.
Definition: flags.hh:116
gem5::CheckpointIn
Definition: serialize.hh:68
gem5::Flags::clear
void clear()
Clear all flag's bits.
Definition: flags.hh:102
gem5::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:175
named.hh
gem5::EventBase::InitMask
static const FlagsType InitMask
Definition: eventq.hh:120
gem5::Event::removeItem
static Event * removeItem(Event *event, Event *last)
Definition: eventq.cc:161
gem5::MipsISA::event
Bitfield< 10, 5 > event
Definition: pra_constants.hh:300
gem5::EventBase::Scheduled
static const FlagsType Scheduled
Definition: eventq.hh:108
gem5::getEventQueue
EventQueue * getEventQueue(uint32_t index)
Function for returning eventq queue for the provided index.
Definition: eventq.cc:62
cur_tick.hh
gem5::EventQueue::reschedule
void reschedule(Event *event, Tick when, bool always=false)
Reschedule the specified event.
Definition: eventq.hh:814
gem5::inParallelMode
bool inParallelMode
Current mode of execution: parallel / serial.
Definition: eventq.cc:59
gem5::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:290
gem5::EventQueue::lock
void lock()
Provide an interface for locking/unlocking the event queue.
Definition: eventq.hh:947
gem5::EventManager::schedule
void schedule(Event *event, Tick when)
Definition: eventq.hh:1039
gem5::EventManager::schedule
void schedule(Event &event, Tick when)
Definition: eventq.hh:1012
std::vector
STL vector class.
Definition: stl.hh:37
gem5::EventQueue::ScopedMigration::~ScopedMigration
~ScopedMigration()
Definition: eventq.hh:693
gem5::EventQueue::ScopedMigration::old_eq
EventQueue & old_eq
Definition: eventq.hh:704
gem5::Event::release
void release()
Managed event removed from the event queue.
Definition: eventq.cc:119
gem5::VegaISA::r
Bitfield< 5 > r
Definition: pagetable.hh:60
gem5::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:190
gem5::EventFunctionWrapper::callback
std::function< void(void)> callback
Definition: eventq.hh:1139
gem5::EventQueue::head
Event * head
Definition: eventq.hh:621
gem5::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:923
gem5::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:214
gem5::MemberEventWrapper<&BaseRemoteGDB::detach >::CLASS
MemberFunctionClass_t< F > CLASS
Definition: eventq.hh:1093
gem5::MemberEventWrapper::MemberEventWrapper
MemberEventWrapper(CLASS &object, bool del=false, Priority p=Default_Pri)
Construct a new MemberEventWrapper object.
Definition: eventq.hh:1112
gem5::Event::releaseImpl
virtual void releaseImpl()
Definition: eventq.cc:131
gem5::EventQueue::getHead
Event * getHead() const
Definition: eventq.hh:851
gem5::EventQueue::serviceEvents
void serviceEvents(Tick when)
process all events up to the given timestamp.
Definition: eventq.hh:869
gem5::EventBase::Progress_Event_Pri
static const Priority Progress_Event_Pri
Progress events come at the end.
Definition: eventq.hh:229
gem5::Event::setFlags
void setFlags(Flags _flags)
Definition: eventq.hh:331
gem5::EventQueue::ScopedMigration::doMigrate
bool doMigrate
Definition: eventq.hh:705
gem5::EventQueue::async_queue
std::list< Event * > async_queue
List of events added by other threads to this event queue.
Definition: eventq.hh:628
gem5::Event::priority
Priority priority() const
Get the event priority.
Definition: eventq.hh:508
gem5::EventBase::AutoDelete
static const FlagsType AutoDelete
Definition: eventq.hh:110
gem5::Named
Interface for things with names.
Definition: named.hh:38
gem5::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:166
gem5::MemberFunctionArgsTuple_t
typename MemberFunctionSignature< decltype(F)>::argsTuple_t MemberFunctionArgsTuple_t
Definition: type_traits.hh:93
gem5::operator<=
bool operator<=(const Time &l, const Time &r)
Definition: time.hh:226
gem5::X86ISA::em
Bitfield< 2 > em
Definition: misc.hh:607
gem5::EventBase::Squashed
static const FlagsType Squashed
Definition: eventq.hh:107
gem5::MemberEventWrapper::description
const char * description() const override
Return a C string describing the event.
Definition: eventq.hh:1127
gem5::Event::initialized
bool initialized() const
Definition: eventq.hh:311
gem5::EventQueue::handleAsyncInsertions
void handleAsyncInsertions()
Function for moving events from the async_queue to the main queue.
Definition: eventq.cc:458
gem5::EventManager
Definition: eventq.hh:980
gem5::Serializable
Basic support for object serialization.
Definition: serialize.hh:169
gem5::Flags< FlagsType >
gem5::EventQueue::insert
void insert(Event *event)
Insert / remove event from the queue.
Definition: eventq.cc:138
gem5::Event::getFlags
Flags getFlags() const
Definition: eventq.hh:318
gem5::EventBase::IsExitEvent
static const FlagsType IsExitEvent
Definition: eventq.hh:117
gem5::BaseGlobalEvent
Common base class for GlobalEvent and GlobalSyncEvent.
Definition: global_event.hh:63
gem5::Named::name
virtual std::string name() const
Definition: named.hh:47
gem5::EventManager::setCurTick
void setCurTick(Tick newVal)
Definition: eventq.hh:1073
gem5::VegaISA::p
Bitfield< 54 > p
Definition: pagetable.hh:70
gem5::Flags::isSet
bool isSet(Type mask) const
Verifies whether any bit matching the given mask is set.
Definition: flags.hh:83
gem5::EventBase::Minimum_Pri
static const Priority Minimum_Pri
Event priorities, to provide tie-breakers for events scheduled at the same cycle.
Definition: eventq.hh:138
gem5::Event
Definition: eventq.hh:254
gem5::Event::instanceCounter
static Counter instanceCounter
Global counter to generate unique IDs for Event instances.
Definition: eventq.hh:280
gem5::EventQueue::deschedule
void deschedule(Event *event)
Deschedule the specified event.
Definition: eventq.hh:790
gem5::EventBase::IsMainQueue
static const FlagsType IsMainQueue
Definition: eventq.hh:118
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::EventQueue::ScopedRelease::~ScopedRelease
~ScopedRelease()
Definition: eventq.hh:729
gem5::EventFunctionWrapper::name
const std::string name() const
Definition: eventq.hh:1168
gem5::EventBase::Maximum_Pri
static const Priority Maximum_Pri
Maximum priority.
Definition: eventq.hh:244
gem5::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:147
gem5::EventQueue::setCurTick
void setCurTick(Tick newVal)
Definition: eventq.hh:837
gem5::EventQueue::async_queue_mutex
UncontendedMutex async_queue_mutex
Mutex to protect async queue.
Definition: eventq.hh:625
gem5::Event::process
virtual void process()=0
gem5::EventQueue::nextTick
Tick nextTick() const
Definition: eventq.hh:836
gem5::EventManager::eventq
EventQueue * eventq
A pointer to this object's event queue.
Definition: eventq.hh:984
gem5::EventQueue::EventQueue
EventQueue(const EventQueue &)
gem5::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:156
gem5::Event::clearFlags
void clearFlags(Flags _flags)
Definition: eventq.hh:338
gem5::EventQueue
Queue of events sorted in time order.
Definition: eventq.hh:615
debug.hh
gem5::EventManager::deschedule
void deschedule(Event *event)
Definition: eventq.hh:1048
gem5::EventBase::Initialized
static const FlagsType Initialized
Definition: eventq.hh:119
gem5::Event::globalEvent
virtual BaseGlobalEvent * globalEvent()
If this is part of a GlobalEvent, return the pointer to the Global Event.
Definition: eventq.hh:513
gem5::EventQueue::ScopedMigration
Definition: eventq.hh:665
gem5::simQuantum
Tick simQuantum
Simulation Quantum for multiple eventq simulation.
Definition: eventq.cc:48
gem5::EventQueue::empty
bool empty() const
Returns true if no events are queued.
Definition: eventq.hh:891
gem5::MemberFunctionClass_t
typename MemberFunctionSignature< decltype(F)>::class_t MemberFunctionClass_t
Definition: type_traits.hh:85
gem5::EventManager::reschedule
void reschedule(Event &event, Tick when, bool always=false)
Definition: eventq.hh:1030
gem5::_curEventQueue
__thread EventQueue * _curEventQueue
The current event queue for the running thread.
Definition: eventq.cc:58
gem5::MemberEventWrapper::mObject
CLASS * mObject
Definition: eventq.hh:1129
gem5::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:1068
gem5::EventQueue::ScopedRelease::eq
EventQueue & eq
Definition: eventq.hh:735
gem5::Event::isAutoDelete
bool isAutoDelete() const
The function returns true if the object is automatically deleted after the event is processed.
Definition: eventq.hh:494
gem5::Event::acquire
void acquire()
Memory management hooks for events that have the Managed flag set.
Definition: eventq.cc:112
gem5::Event::nextBin
Event * nextBin
Definition: eventq.hh:268
gem5::EventBase::Managed
static const FlagsType Managed
Definition: eventq.hh:109
gem5::EventQueue::curEventQueue
friend void curEventQueue(EventQueue *)
Definition: eventq.hh:972
gem5::EventManager::EventManager
EventManager(EventQueue *eq)
Definition: eventq.hh:996
gem5::operator>
bool operator>(const Time &l, const Time &r)
Definition: time.hh:233
gem5::EventBase::FlagsType
unsigned short FlagsType
Definition: eventq.hh:102
gem5::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:850
flags.hh
uncontended_mutex.hh
gem5::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:222
gem5::EventManager::deschedule
void deschedule(Event &event)
Definition: eventq.hh:1021
gem5::Event::_priority
Priority _priority
event priority
Definition: eventq.hh:275
gem5::EventFunctionWrapper::process
void process()
Definition: eventq.hh:1162
gem5::EventBase::PublicRead
static const FlagsType PublicRead
Definition: eventq.hh:105
gem5::EventFunctionWrapper
Definition: eventq.hh:1136
gem5::EventManager::reschedule
void reschedule(Event *event, Tick when, bool always=false)
Definition: eventq.hh:1057
gem5::Event::_when
Tick _when
timestamp when event should be processed
Definition: eventq.hh:274
gem5::ArmISA::q
Bitfield< 27 > q
Definition: misc_types.hh:55
gem5::Event::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: eventq.cc:265
gem5::Event::setWhen
void setWhen(Tick when, EventQueue *q)
Definition: eventq.hh:299
gem5::curEventQueue
EventQueue * curEventQueue()
Definition: eventq.hh:91
gem5::ArmISA::n
Bitfield< 31 > n
Definition: misc_types.hh:513
types.hh
gem5::PowerISA::eq
Bitfield< 29 > eq
Definition: misc.hh:58
gem5::Event::flags
Flags flags
Definition: eventq.hh:276
gem5::operator==
static bool operator==(const PCStateBase &a, const PCStateBase &b)
Definition: pcstate.hh:155
gem5::EventBase::Priority
int8_t Priority
Definition: eventq.hh:126
gem5::EventQueue::checkpointReschedule
void checkpointReschedule(Event *event)
Reschedule an event after a checkpoint.
Definition: eventq.cc:306
gem5::Event::squashed
bool squashed() const
Check whether the event is squashed.
Definition: eventq.hh:472
gem5::Event::acquireImpl
virtual void acquireImpl()
Definition: eventq.cc:126
gem5::numMainEventQueues
uint32_t numMainEventQueues
Current number of allocated main event queues.
Definition: eventq.cc:56
gem5::Event::isFlagSet
bool isFlagSet(Flags _flags) const
Definition: eventq.hh:324
gem5::Event::insertBefore
static Event * insertBefore(Event *event, Event *curr)
Definition: eventq.cc:91
gem5::EventFunctionWrapper::description
const char * description() const
Return a C string describing the event.
Definition: eventq.hh:1176
gem5::Event::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: eventq.cc:274
gem5::EventQueue::asyncInsert
void asyncInsert(Event *event)
Function for adding events to the async queue.
Definition: eventq.cc:450
gem5::statistics::Counter
double Counter
All counters are of 64-bit values.
Definition: types.hh:46
gem5::EventQueue::debugVerify
bool debugVerify() const
Definition: eventq.cc:340
gem5::Event::~Event
virtual ~Event()
Definition: eventq.cc:77
gem5::EventQueue::remove
void remove(Event *event)
Definition: eventq.cc:192
gem5::EventQueue::schedule
void schedule(Event *event, Tick when, bool global=false)
Schedule the given event on this queue.
Definition: eventq.hh:757
gem5::operator<
bool operator<(const Time &l, const Time &r)
Definition: time.hh:219
gem5::VegaISA::l
Bitfield< 55 > l
Definition: pagetable.hh:54
gem5::Event::instanceString
const std::string instanceString() const
Return the instance number as a string.
Definition: eventq.cc:417
gem5::CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:66
gem5::MemberFunctionReturn_t
typename MemberFunctionSignature< decltype(F)>::return_t MemberFunctionReturn_t
Definition: type_traits.hh:89
gem5::EventBase
Common base class for Event and GlobalEvent, so they can share flag and priority definitions and acce...
Definition: eventq.hh:99
trace.hh
gem5::Event::squash
void squash()
Squash the current event.
Definition: eventq.hh:465
gem5_assert
#define gem5_assert(cond,...)
The assert macro will function like a normal assert, but will use panic instead of straight abort().
Definition: logging.hh:317
std::list
STL list class.
Definition: stl.hh:51
gem5::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:207
gem5::EventBase::Default_Pri
static const Priority Default_Pri
Default is zero for historical reasons.
Definition: eventq.hh:182
type_traits.hh
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::Event::instance
Counter instance
This event's unique ID.
Definition: eventq.hh:286
gem5::EventManager::EventManager
EventManager(EventManager *em)
Definition: eventq.hh:995
gem5::EventQueue::serviceOne
Event * serviceOne()
Definition: eventq.cc:224
gem5::operator!=
static bool operator!=(const PCStateBase &a, const PCStateBase &b)
Definition: pcstate.hh:161
gem5::EventQueue::name
virtual const std::string name() const
Definition: eventq.hh:747
gem5::EventQueue::service_mutex
UncontendedMutex service_mutex
Lock protecting event handling.
Definition: eventq.hh:650
gem5::ArmISA::st
Bitfield< 31, 28 > st
Definition: misc_types.hh:180
gem5::Event::trace
virtual void trace(const char *action)
This function isn't really useful if TRACING_ON is not defined.
Definition: eventq.cc:405
gem5::EventQueue::ScopedRelease::ScopedRelease
ScopedRelease(EventQueue *_eq)
Temporarily release the event queue service lock.
Definition: eventq.hh:723
gem5::Gem5Internal::_curTickPtr
__thread Tick * _curTickPtr
Definition: cur_tick.cc:37
gem5::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:199
gem5::EventQueue::ScopedMigration::ScopedMigration
ScopedMigration(EventQueue *_new_eq, bool _doMigrate=true)
Temporarily migrate execution to a different event queue.
Definition: eventq.hh:682
gem5::Event::scheduled
bool scheduled() const
Determine if the current event is scheduled.
Definition: eventq.hh:458
gem5::Event::dump
void dump() const
Dump the current event data.
Definition: eventq.cc:427
gem5::Flags::noneSet
bool noneSet(Type mask) const
Verifies whether no bits matching the given mask are set.
Definition: flags.hh:99
gem5::MemberEventWrapper
Wrap a member function inside MemberEventWrapper to use it as an event callback.
Definition: eventq.hh:1091
gem5::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:237
gem5::EventQueue::dump
void dump() const
This is a debugging function which will print everything on the event queue.
Definition: eventq.cc:315
gem5::EventBase::PublicWrite
static const FlagsType PublicWrite
Definition: eventq.hh:106
gem5::UncontendedMutex::unlock
void unlock()
Definition: uncontended_mutex.hh:95
gem5::dumpMainQueue
void dumpMainQueue()
Definition: eventq.cc:390

Generated on Sun Jul 30 2023 01:56:59 for gem5 by doxygen 1.8.17