gem5  v21.1.0.2
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/cur_tick.hh"
53 #include "sim/serialize.hh"
54 
55 namespace gem5
56 {
57 
58 class EventQueue; // forward declaration
59 class BaseGlobalEvent;
60 
66 extern Tick simQuantum;
67 
69 extern uint32_t numMainEventQueues;
70 
73 
76 
77 extern __thread EventQueue *_curEventQueue;
78 
80 extern bool inParallelMode;
81 
86 EventQueue *getEventQueue(uint32_t index);
87 
89 inline void curEventQueue(EventQueue *q);
90 
96 class EventBase
97 {
98  protected:
99  typedef unsigned short FlagsType;
100  typedef ::gem5::Flags<FlagsType> Flags;
101 
102  static const FlagsType PublicRead = 0x003f; // public readable flags
103  static const FlagsType PublicWrite = 0x001d; // public writable flags
104  static const FlagsType Squashed = 0x0001; // has been squashed
105  static const FlagsType Scheduled = 0x0002; // has been scheduled
106  static const FlagsType Managed = 0x0004; // Use life cycle manager
107  static const FlagsType AutoDelete = Managed; // delete after dispatch
113  static const FlagsType Reserved0 = 0x0008;
114  static const FlagsType IsExitEvent = 0x0010; // special exit event
115  static const FlagsType IsMainQueue = 0x0020; // on main event queue
116  static const FlagsType Initialized = 0x7a40; // somewhat random bits
117  static const FlagsType InitMask = 0xffc0; // mask for init bits
118 
119  public:
123  typedef int8_t Priority;
124 
129 
135  static const Priority Minimum_Pri = SCHAR_MIN;
136 
144  static const Priority Debug_Enable_Pri = -101;
145 
153  static const Priority Debug_Break_Pri = -100;
154 
163  static const Priority CPU_Switch_Pri = -31;
164 
172  static const Priority Delayed_Writeback_Pri = -1;
173 
179  static const Priority Default_Pri = 0;
180 
187  static const Priority DVFS_Update_Pri = 31;
188 
196  static const Priority Serialize_Pri = 32;
197 
204  static const Priority CPU_Tick_Pri = 50;
205 
211  static const Priority CPU_Exit_Pri = 64;
212 
219  static const Priority Stat_Event_Pri = 90;
220 
226  static const Priority Progress_Event_Pri = 95;
227 
234  static const Priority Sim_Exit_Pri = 100;
235 
241  static const Priority Maximum_Pri = SCHAR_MAX;
242 };
243 
244 /*
245  * An item on an event queue. The action caused by a given
246  * event is specified by deriving a subclass and overriding the
247  * process() member function.
248  *
249  * Caution, the order of members is chosen to maximize data packing.
250  */
251 class Event : public EventBase, public Serializable
252 {
253  friend class EventQueue;
254 
255  private:
256  // The event queue is now a linked list of linked lists. The
257  // 'nextBin' pointer is to find the bin, where a bin is defined as
258  // when+priority. All events in the same bin will be stored in a
259  // second linked list (a stack) maintained by the 'nextInBin'
260  // pointer. The list will be accessed in LIFO order. The end
261  // result is that the insert/removal in 'nextBin' is
262  // linear/constant, and the lookup/removal in 'nextInBin' is
263  // constant/constant. Hopefully this is a significant improvement
264  // over the current fully linear insertion.
267 
268  static Event *insertBefore(Event *event, Event *curr);
269  static Event *removeItem(Event *event, Event *last);
270 
274 
275 #ifndef NDEBUG
276  static Counter instanceCounter;
278 
284 
288 #endif
289 
290 #ifdef EVENTQ_DEBUG
291  Tick whenCreated;
292  Tick whenScheduled;
293 #endif
294 
295  void
297  {
298  _when = when;
299 #ifndef NDEBUG
300  queue = q;
301 #endif
302 #ifdef EVENTQ_DEBUG
303  whenScheduled = curTick();
304 #endif
305  }
306 
307  bool
308  initialized() const
309  {
310  return (flags & InitMask) == Initialized;
311  }
312 
313  protected:
314  Flags
315  getFlags() const
316  {
317  return flags & PublicRead;
318  }
319 
320  bool
321  isFlagSet(Flags _flags) const
322  {
323  assert(_flags.noneSet(~PublicRead));
324  return flags.isSet(_flags);
325  }
326 
327  void
328  setFlags(Flags _flags)
329  {
330  assert(_flags.noneSet(~PublicWrite));
331  flags.set(_flags);
332  }
333 
334  void
336  {
337  assert(_flags.noneSet(~PublicWrite));
338  flags.clear(_flags);
339  }
340 
341  void
343  {
345  }
346 
352  virtual void trace(const char *action);
353 
355  const std::string instanceString() const;
356 
357  protected: /* Memory management */
383  void acquire()
384  {
386  acquireImpl();
387  }
388 
392  void release() {
394  releaseImpl();
395  }
396 
397  virtual void acquireImpl() {}
398 
399  virtual void releaseImpl() {
400  if (!scheduled())
401  delete this;
402  }
403 
406  public:
407 
408  /*
409  * Event constructor
410  * @param queue that the event gets scheduled on
411  *
412  * @ingroup api_eventq
413  */
415  : nextBin(nullptr), nextInBin(nullptr), _when(0), _priority(p),
416  flags(Initialized | f)
417  {
418  assert(f.noneSet(~PublicWrite));
419 #ifndef NDEBUG
421  queue = NULL;
422 #endif
423 #ifdef EVENTQ_DEBUG
424  whenCreated = curTick();
425  whenScheduled = 0;
426 #endif
427  }
428 
433  virtual ~Event();
434  virtual const std::string name() const;
435 
439  virtual const char *description() const;
440 
442  void dump() const; //end of api group
444 
445  public:
446  /*
447  * This member function is invoked when the event is processed
448  * (occurs). There is no default implementation; each subclass
449  * must provide its own implementation. The event is not
450  * automatically deleted after it is processed (to allow for
451  * statically allocated event objects).
452  *
453  * If the AutoDestroy flag is set, the object is deleted once it
454  * is processed.
455  *
456  * @ingroup api_eventq
457  */
458  virtual void process() = 0;
459 
465  bool scheduled() const { return flags.isSet(Scheduled); }
466 
472  void squash() { flags.set(Squashed); }
473 
479  bool squashed() const { return flags.isSet(Squashed); }
480 
486  bool isExitEvent() const { return flags.isSet(IsExitEvent); }
487 
493  bool isManaged() const { return flags.isSet(Managed); }
494 
501  bool isAutoDelete() const { return isManaged(); }
502 
508  Tick when() const { return _when; }
509 
515  Priority priority() const { return _priority; }
516 
520  virtual BaseGlobalEvent *globalEvent() { return NULL; }
521 
522  void serialize(CheckpointOut &cp) const override;
523  void unserialize(CheckpointIn &cp) override;
524 };
525 
529 inline bool
530 operator<(const Event &l, const Event &r)
531 {
532  return l.when() < r.when() ||
533  (l.when() == r.when() && l.priority() < r.priority());
534 }
535 
539 inline bool
540 operator>(const Event &l, const Event &r)
541 {
542  return l.when() > r.when() ||
543  (l.when() == r.when() && l.priority() > r.priority());
544 }
545 
549 inline bool
550 operator<=(const Event &l, const Event &r)
551 {
552  return l.when() < r.when() ||
553  (l.when() == r.when() && l.priority() <= r.priority());
554 }
555 
559 inline bool
560 operator>=(const Event &l, const Event &r)
561 {
562  return l.when() > r.when() ||
563  (l.when() == r.when() && l.priority() >= r.priority());
564 }
565 
569 inline bool
570 operator==(const Event &l, const Event &r)
571 {
572  return l.when() == r.when() && l.priority() == r.priority();
573 }
574 
578 inline bool
579 operator!=(const Event &l, const Event &r)
580 {
581  return l.when() != r.when() || l.priority() != r.priority();
582 }
583 
623 {
624  private:
625  friend void curEventQueue(EventQueue *);
626 
627  std::string objName;
630 
633 
636 
658 
661  void insert(Event *event);
662  void remove(Event *event);
663 
667  void asyncInsert(Event *event);
668 
669  EventQueue(const EventQueue &);
670 
671  public:
673  {
674  public:
689  ScopedMigration(EventQueue *_new_eq, bool _doMigrate = true)
690  :new_eq(*_new_eq), old_eq(*curEventQueue()),
691  doMigrate((&new_eq != &old_eq)&&_doMigrate)
692  {
693  if (doMigrate){
694  old_eq.unlock();
695  new_eq.lock();
697  }
698  }
699 
701  {
702  if (doMigrate){
703  new_eq.unlock();
704  old_eq.lock();
706  }
707  }
708 
709  private:
712  bool doMigrate;
713  };
714 
715 
717  {
718  public:
731  : eq(*_eq)
732  {
733  eq.unlock();
734  }
735 
737  {
738  eq.lock();
739  }
740 
741  private:
743  };
744 
748  EventQueue(const std::string &n);
749 
754  virtual const std::string name() const { return objName; }
755  void name(const std::string &st) { objName = st; } //end of api_eventq group
757 
763  void
764  schedule(Event *event, Tick when, bool global=false)
765  {
766  assert(when >= getCurTick());
767  assert(!event->scheduled());
768  assert(event->initialized());
769 
770  event->setWhen(when, this);
771 
772  // The check below is to make sure of two things
773  // a. A thread schedules local events on other queues through the
774  // asyncq.
775  // b. A thread schedules global events on the asyncq, whether or not
776  // this event belongs to this eventq. This is required to maintain
777  // a total order amongst the global events. See global_event.{cc,hh}
778  // for more explanation.
779  if (inParallelMode && (this != curEventQueue() || global)) {
781  } else {
782  insert(event);
783  }
784  event->flags.set(Event::Scheduled);
785  event->acquire();
786 
787  if (debug::Event)
788  event->trace("scheduled");
789  }
790 
796  void
798  {
799  assert(event->scheduled());
800  assert(event->initialized());
801  assert(!inParallelMode || this == curEventQueue());
802 
803  remove(event);
804 
805  event->flags.clear(Event::Squashed);
806  event->flags.clear(Event::Scheduled);
807 
808  if (debug::Event)
809  event->trace("descheduled");
810 
811  event->release();
812  }
813 
820  void
821  reschedule(Event *event, Tick when, bool always=false)
822  {
823  assert(when >= getCurTick());
824  assert(always || event->scheduled());
825  assert(event->initialized());
826  assert(!inParallelMode || this == curEventQueue());
827 
828  if (event->scheduled()) {
829  remove(event);
830  } else {
831  event->acquire();
832  }
833 
834  event->setWhen(when, this);
835  insert(event);
836  event->flags.clear(Event::Squashed);
837  event->flags.set(Event::Scheduled);
838 
839  if (debug::Event)
840  event->trace("rescheduled");
841  }
842 
843  Tick nextTick() const { return head->when(); }
844  void setCurTick(Tick newVal) { _curTick = newVal; }
845 
857  Tick getCurTick() const { return _curTick; }
858  Event *getHead() const { return head; }
859 
860  Event *serviceOne();
861 
875  void
877  {
878  while (!empty()) {
879  if (nextTick() > when)
880  break;
881 
886  //assert(head->when() >= when && "event scheduled in the past");
887  serviceOne();
888  }
889 
890  setCurTick(when);
891  }
892 
898  bool empty() const { return head == NULL; }
899 
906  void dump() const;
907 
908  bool debugVerify() const;
909 
913  void handleAsyncInsertions();
914 
930  virtual void wakeup(Tick when = (Tick)-1) { }
931 
941 
954  void lock() { service_mutex.lock(); }
970 
971  virtual ~EventQueue()
972  {
973  while (!empty())
974  deschedule(getHead());
975  }
976 };
977 
978 inline void
980 {
981  _curEventQueue = q;
982  Gem5Internal::_curTickPtr = (q == nullptr) ? nullptr : &q->_curTick;
983 }
984 
985 void dumpMainQueue();
986 
988 {
989  protected:
992 
993  public:
1003  EventManager(EventQueue *eq) : eventq(eq) {} //end of api_eventq group
1005 
1009  EventQueue *
1010  eventQueue() const
1011  {
1012  return eventq;
1013  }
1014 
1018  void
1020  {
1021  eventq->schedule(&event, when);
1022  }
1023 
1027  void
1029  {
1030  eventq->deschedule(&event);
1031  }
1032 
1036  void
1037  reschedule(Event &event, Tick when, bool always = false)
1038  {
1039  eventq->reschedule(&event, when, always);
1040  }
1041 
1045  void
1047  {
1048  eventq->schedule(event, when);
1049  }
1050 
1054  void
1056  {
1058  }
1059 
1063  void
1064  reschedule(Event *event, Tick when, bool always = false)
1065  {
1066  eventq->reschedule(event, when, always);
1067  }
1068 
1075  void wakeupEventQueue(Tick when = (Tick)-1)
1076  {
1077  eventq->wakeup(when);
1078  }
1079 
1080  void setCurTick(Tick newVal) { eventq->setCurTick(newVal); }
1081 };
1082 
1083 template <class T, void (T::* F)()>
1084 class EventWrapper : public Event
1085 {
1086  private:
1088 
1089  public:
1090  EventWrapper(T *obj, bool del = false, Priority p = Default_Pri)
1091  : Event(p), object(obj)
1092  {
1093  if (del)
1095  }
1096 
1097  EventWrapper(T &obj, bool del = false, Priority p = Default_Pri)
1098  : Event(p), object(&obj)
1099  {
1100  if (del)
1102  }
1103 
1104  void process() { (object->*F)(); }
1105 
1106  const std::string
1107  name() const
1108  {
1109  return object->name() + ".wrapped_event";
1110  }
1111 
1112  const char *description() const { return "EventWrapped"; }
1113 };
1114 
1116 {
1117  private:
1118  std::function<void(void)> callback;
1119  std::string _name;
1120 
1121  public:
1128  EventFunctionWrapper(const std::function<void(void)> &callback,
1129  const std::string &name,
1130  bool del = false,
1133  {
1134  if (del)
1136  }
1137 
1141  void process() { callback(); }
1142 
1146  const std::string
1147  name() const
1148  {
1149  return _name + ".wrapped_function_event";
1150  }
1151 
1155  const char *description() const { return "EventFunctionWrapped"; }
1156 };
1157 
1163 #define SERIALIZE_EVENT(event) event.serializeSection(cp, #event);
1164 
1170 #define UNSERIALIZE_EVENT(event) \
1171  do { \
1172  event.unserializeSection(cp, #event); \
1173  eventQueue()->checkpointReschedule(&event); \
1174  } while (0)
1175 
1176 } // namespace gem5
1177 
1178 #endif // __SIM_EVENTQ_HH__
gem5::EventQueue::name
void name(const std::string &st)
Definition: eventq.hh:755
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:1128
gem5::EventQueue::_curTick
Tick _curTick
Definition: eventq.hh:629
gem5::EventBase::Flags
::gem5::Flags< FlagsType > Flags
Definition: eventq.hh:100
gem5::EventQueue::ScopedMigration::new_eq
EventQueue & new_eq
Definition: eventq.hh:710
gem5::EventManager::EventManager
EventManager(EventManager &em)
Event manger manages events in the event queue.
Definition: eventq.hh:1001
gem5::Event::isExitEvent
bool isExitEvent() const
See if this is a SimExitEvent (without resorting to RTTI)
Definition: eventq.hh:486
gem5::operator!=
bool operator!=(const RefCountingPtr< T > &l, const RefCountingPtr< T > &r)
Check for inequality of two reference counting pointers.
Definition: refcnt.hh:294
gem5::Event::description
virtual const char * description() const
Return a C string describing the event.
Definition: eventq.cc:373
gem5::Event::isManaged
bool isManaged() const
Check whether this event will auto-delete.
Definition: eventq.hh:493
gem5::Event::when
Tick when() const
Get the time that the event is scheduled.
Definition: eventq.hh:508
gem5::operator>=
bool operator>=(const Time &l, const Time &r)
Definition: time.hh:240
gem5::EventQueue::ScopedRelease
Definition: eventq.hh:716
gem5::EventQueue::~EventQueue
virtual ~EventQueue()
Definition: eventq.hh:971
gem5::Event::name
virtual const std::string name() const
Definition: eventq.cc:84
gem5::EventFunctionWrapper::_name
std::string _name
Definition: eventq.hh:1119
gem5::UncontendedMutex
Definition: uncontended_mutex.hh:47
gem5::Event::clearFlags
void clearFlags()
Definition: eventq.hh:342
gem5::UncontendedMutex::lock
void lock()
Definition: uncontended_mutex.hh:70
gem5::EventWrapper
Definition: eventq.hh:1084
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:356
gem5::EventManager::eventQueue
EventQueue * eventQueue() const
Definition: eventq.hh:1010
serialize.hh
gem5::EventQueue::objName
std::string objName
Definition: eventq.hh:627
gem5::Event::nextInBin
Event * nextInBin
Definition: eventq.hh:266
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:113
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:414
gem5::EventQueue::unlock
void unlock()
Definition: eventq.hh:955
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::ArmISA::f
Bitfield< 6 > f
Definition: misc_types.hh:67
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:172
gem5::EventBase::InitMask
static const FlagsType InitMask
Definition: eventq.hh:117
gem5::Event::removeItem
static Event * removeItem(Event *event, Event *last)
Definition: eventq.cc:135
gem5::MipsISA::event
Bitfield< 10, 5 > event
Definition: pra_constants.hh:300
gem5::EventBase::Scheduled
static const FlagsType Scheduled
Definition: eventq.hh:105
gem5::getEventQueue
EventQueue * getEventQueue(uint32_t index)
Function for returning eventq queue for the provided index.
Definition: eventq.cc:62
cur_tick.hh
gem5::Event::acquireImpl
virtual void acquireImpl()
Definition: eventq.hh:397
gem5::EventWrapper::description
const char * description() const
Return a C string describing the event.
Definition: eventq.hh:1112
gem5::EventQueue::reschedule
void reschedule(Event *event, Tick when, bool always=false)
Reschedule the specified event.
Definition: eventq.hh:821
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:287
gem5::EventQueue::lock
void lock()
Provide an interface for locking/unlocking the event queue.
Definition: eventq.hh:954
gem5::EventWrapper::object
T * object
Definition: eventq.hh:1087
gem5::EventManager::schedule
void schedule(Event *event, Tick when)
Definition: eventq.hh:1046
gem5::EventManager::schedule
void schedule(Event &event, Tick when)
Definition: eventq.hh:1019
gem5::Event::releaseImpl
virtual void releaseImpl()
Definition: eventq.hh:399
std::vector
STL vector class.
Definition: stl.hh:37
gem5::EventQueue::ScopedMigration::~ScopedMigration
~ScopedMigration()
Definition: eventq.hh:700
gem5::EventQueue::ScopedMigration::old_eq
EventQueue & old_eq
Definition: eventq.hh:711
gem5::Event::release
void release()
Managed event removed from the event queue.
Definition: eventq.hh:392
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:187
gem5::EventFunctionWrapper::callback
std::function< void(void)> callback
Definition: eventq.hh:1118
gem5::EventQueue::head
Event * head
Definition: eventq.hh:628
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:930
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:211
gem5::EventQueue::getHead
Event * getHead() const
Definition: eventq.hh:858
gem5::EventQueue::serviceEvents
void serviceEvents(Tick when)
process all events up to the given timestamp.
Definition: eventq.hh:876
gem5::EventBase::Progress_Event_Pri
static const Priority Progress_Event_Pri
Progress events come at the end.
Definition: eventq.hh:226
gem5::Event::setFlags
void setFlags(Flags _flags)
Definition: eventq.hh:328
gem5::EventQueue::ScopedMigration::doMigrate
bool doMigrate
Definition: eventq.hh:712
gem5::EventQueue::async_queue
std::list< Event * > async_queue
List of events added by other threads to this event queue.
Definition: eventq.hh:635
gem5::Event::priority
Priority priority() const
Get the event priority.
Definition: eventq.hh:515
gem5::EventBase::AutoDelete
static const FlagsType AutoDelete
Definition: eventq.hh:107
gem5::EventWrapper::name
const std::string name() const
Definition: eventq.hh:1107
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:163
gem5::operator<=
bool operator<=(const Time &l, const Time &r)
Definition: time.hh:226
gem5::X86ISA::em
Bitfield< 2 > em
Definition: misc.hh:608
gem5::EventBase::Squashed
static const FlagsType Squashed
Definition: eventq.hh:104
gem5::Event::initialized
bool initialized() const
Definition: eventq.hh:308
gem5::EventQueue::handleAsyncInsertions
void handleAsyncInsertions()
Function for moving events from the async_queue to the main queue.
Definition: eventq.cc:432
gem5::EventManager
Definition: eventq.hh:987
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:112
gem5::EventWrapper::EventWrapper
EventWrapper(T *obj, bool del=false, Priority p=Default_Pri)
Definition: eventq.hh:1090
gem5::Event::getFlags
Flags getFlags() const
Definition: eventq.hh:315
gem5::EventBase::IsExitEvent
static const FlagsType IsExitEvent
Definition: eventq.hh:114
gem5::BaseGlobalEvent
Common base class for GlobalEvent and GlobalSyncEvent.
Definition: global_event.hh:63
gem5::EventManager::setCurTick
void setCurTick(Tick newVal)
Definition: eventq.hh:1080
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:135
gem5::Event
Definition: eventq.hh:251
gem5::Event::instanceCounter
static Counter instanceCounter
Global counter to generate unique IDs for Event instances.
Definition: eventq.hh:277
gem5::EventQueue::deschedule
void deschedule(Event *event)
Deschedule the specified event.
Definition: eventq.hh:797
gem5::EventBase::IsMainQueue
static const FlagsType IsMainQueue
Definition: eventq.hh:115
gem5::MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:326
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::EventQueue::ScopedRelease::~ScopedRelease
~ScopedRelease()
Definition: eventq.hh:736
gem5::EventFunctionWrapper::name
const std::string name() const
Definition: eventq.hh:1147
gem5::EventBase::Maximum_Pri
static const Priority Maximum_Pri
Maximum priority.
Definition: eventq.hh:241
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:144
gem5::EventQueue::setCurTick
void setCurTick(Tick newVal)
Definition: eventq.hh:844
gem5::EventQueue::async_queue_mutex
UncontendedMutex async_queue_mutex
Mutex to protect async queue.
Definition: eventq.hh:632
gem5::Event::process
virtual void process()=0
gem5::ArmISA::s
Bitfield< 4 > s
Definition: misc_types.hh:561
gem5::EventQueue::nextTick
Tick nextTick() const
Definition: eventq.hh:843
gem5::EventManager::eventq
EventQueue * eventq
A pointer to this object's event queue.
Definition: eventq.hh:991
gem5::EventQueue::EventQueue
EventQueue(const EventQueue &)
gem5::operator==
bool operator==(const Pixel &lhs, const Pixel &rhs)
Definition: pixel.hh:73
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:153
gem5::Event::clearFlags
void clearFlags(Flags _flags)
Definition: eventq.hh:335
gem5::EventQueue
Queue of events sorted in time order.
Definition: eventq.hh:622
debug.hh
gem5::EventManager::deschedule
void deschedule(Event *event)
Definition: eventq.hh:1055
gem5::EventBase::Initialized
static const FlagsType Initialized
Definition: eventq.hh:116
gem5::Event::globalEvent
virtual BaseGlobalEvent * globalEvent()
If this is part of a GlobalEvent, return the pointer to the Global Event.
Definition: eventq.hh:520
gem5::EventQueue::ScopedMigration
Definition: eventq.hh:672
gem5::MipsISA::l
Bitfield< 5 > l
Definition: pra_constants.hh:323
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:898
gem5::EventManager::reschedule
void reschedule(Event &event, Tick when, bool always=false)
Definition: eventq.hh:1037
gem5::_curEventQueue
__thread EventQueue * _curEventQueue
The current event queue for the running thread.
Definition: eventq.cc:58
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:1075
gem5::EventQueue::ScopedRelease::eq
EventQueue & eq
Definition: eventq.hh:742
gem5::Event::isAutoDelete
bool isAutoDelete() const
The function returns true if the object is automatically deleted after the event is processed.
Definition: eventq.hh:501
gem5::Event::acquire
void acquire()
Memory management hooks for events that have the Managed flag set.
Definition: eventq.hh:383
gem5::Event::nextBin
Event * nextBin
Definition: eventq.hh:265
gem5::EventBase::Managed
static const FlagsType Managed
Definition: eventq.hh:106
gem5::EventQueue::curEventQueue
friend void curEventQueue(EventQueue *)
Definition: eventq.hh:979
gem5::EventManager::EventManager
EventManager(EventQueue *eq)
Definition: eventq.hh:1003
gem5::operator>
bool operator>(const Time &l, const Time &r)
Definition: time.hh:233
gem5::EventBase::FlagsType
unsigned short FlagsType
Definition: eventq.hh:99
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:857
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:219
gem5::EventManager::deschedule
void deschedule(Event &event)
Definition: eventq.hh:1028
gem5::Event::_priority
Priority _priority
event priority
Definition: eventq.hh:272
gem5::EventWrapper::process
void process()
Definition: eventq.hh:1104
gem5::EventFunctionWrapper::process
void process()
Definition: eventq.hh:1141
gem5::EventBase::PublicRead
static const FlagsType PublicRead
Definition: eventq.hh:102
gem5::EventFunctionWrapper
Definition: eventq.hh:1115
gem5::EventManager::reschedule
void reschedule(Event *event, Tick when, bool always=false)
Definition: eventq.hh:1064
gem5::Event::_when
Tick _when
timestamp when event should be processed
Definition: eventq.hh:271
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:239
gem5::Event::setWhen
void setWhen(Tick when, EventQueue *q)
Definition: eventq.hh:296
gem5::EventWrapper::EventWrapper
EventWrapper(T &obj, bool del=false, Priority p=Default_Pri)
Definition: eventq.hh:1097
gem5::curEventQueue
EventQueue * curEventQueue()
Definition: eventq.hh:88
gem5::ArmISA::n
Bitfield< 31 > n
Definition: misc_types.hh:455
types.hh
gem5::PowerISA::eq
Bitfield< 29 > eq
Definition: misc.hh:53
gem5::Event::flags
Flags flags
Definition: eventq.hh:273
gem5::EventBase::Priority
int8_t Priority
Definition: eventq.hh:123
gem5::EventQueue::checkpointReschedule
void checkpointReschedule(Event *event)
Reschedule an event after a checkpoint.
Definition: eventq.cc:280
gem5::Event::squashed
bool squashed() const
Check whether the event is squashed.
Definition: eventq.hh:479
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:321
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:1155
gem5::Event::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: eventq.cc:248
gem5::EventQueue::asyncInsert
void asyncInsert(Event *event)
Function for adding events to the async queue.
Definition: eventq.cc:424
gem5::statistics::Counter
double Counter
All counters are of 64-bit values.
Definition: types.hh:47
gem5::EventQueue::debugVerify
bool debugVerify() const
Definition: eventq.cc:314
gem5::Event::~Event
virtual ~Event()
Definition: eventq.cc:77
gem5::EventQueue::remove
void remove(Event *event)
Definition: eventq.cc:166
gem5::EventQueue::schedule
void schedule(Event *event, Tick when, bool global=false)
Schedule the given event on this queue.
Definition: eventq.hh:764
gem5::operator<
bool operator<(const Time &l, const Time &r)
Definition: time.hh:219
gem5::Event::instanceString
const std::string instanceString() const
Return the instance number as a string.
Definition: eventq.cc:391
gem5::MipsISA::r
r
Definition: pra_constants.hh:98
gem5::CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:66
gem5::EventBase
Common base class for Event and GlobalEvent, so they can share flag and priority definitions and acce...
Definition: eventq.hh:96
gem5::Event::squash
void squash()
Squash the current event.
Definition: eventq.hh:472
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:204
gem5::EventBase::Default_Pri
static const Priority Default_Pri
Default is zero for historical reasons.
Definition: eventq.hh:179
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::Event::instance
Counter instance
This event's unique ID.
Definition: eventq.hh:283
gem5::EventManager::EventManager
EventManager(EventManager *em)
Definition: eventq.hh:1002
gem5::EventQueue::serviceOne
Event * serviceOne()
Definition: eventq.cc:198
gem5::EventQueue::name
virtual const std::string name() const
Definition: eventq.hh:754
gem5::EventQueue::service_mutex
UncontendedMutex service_mutex
Lock protecting event handling.
Definition: eventq.hh:657
gem5::ArmISA::st
Bitfield< 31, 28 > st
Definition: misc_types.hh:155
gem5::Event::trace
virtual void trace(const char *action)
This function isn't really useful if TRACING_ON is not defined.
Definition: eventq.cc:379
gem5::EventQueue::ScopedRelease::ScopedRelease
ScopedRelease(EventQueue *_eq)
Temporarily release the event queue service lock.
Definition: eventq.hh:730
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:196
gem5::EventQueue::ScopedMigration::ScopedMigration
ScopedMigration(EventQueue *_new_eq, bool _doMigrate=true)
Temporarily migrate execution to a different event queue.
Definition: eventq.hh:689
gem5::Event::scheduled
bool scheduled() const
Determine if the current event is scheduled.
Definition: eventq.hh:465
gem5::Event::dump
void dump() const
Dump the current event data.
Definition: eventq.cc:401
gem5::Flags::noneSet
bool noneSet(Type mask) const
Verifies whether no bits matching the given mask are set.
Definition: flags.hh:99
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:234
gem5::EventQueue::dump
void dump() const
This is a debugging function which will print everything on the event queue.
Definition: eventq.cc:289
gem5::EventBase::PublicWrite
static const FlagsType PublicWrite
Definition: eventq.hh:103
gem5::UncontendedMutex::unlock
void unlock()
Definition: uncontended_mutex.hh:95
gem5::dumpMainQueue
void dumpMainQueue()
Definition: eventq.cc:364

Generated on Tue Sep 21 2021 12:25:47 for gem5 by doxygen 1.8.17