gem5  v22.1.0.0
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
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 
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__
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
Common base class for GlobalEvent and GlobalSyncEvent.
Definition: global_event.hh:64
Common base class for Event and GlobalEvent, so they can share flag and priority definitions and acce...
Definition: eventq.hh:97
static const FlagsType Squashed
Definition: eventq.hh:104
::gem5::Flags< FlagsType > Flags
Definition: eventq.hh:100
static const FlagsType IsMainQueue
Definition: eventq.hh:115
static const FlagsType Initialized
Definition: eventq.hh:116
static const FlagsType Managed
Definition: eventq.hh:106
static const FlagsType Scheduled
Definition: eventq.hh:105
static const FlagsType AutoDelete
Definition: eventq.hh:107
static const FlagsType PublicWrite
Definition: eventq.hh:103
unsigned short FlagsType
Definition: eventq.hh:99
static const FlagsType PublicRead
Definition: eventq.hh:102
static const FlagsType InitMask
Definition: eventq.hh:117
static const FlagsType Reserved0
This used to be AutoSerialize.
Definition: eventq.hh:113
static const FlagsType IsExitEvent
Definition: eventq.hh:114
std::function< void(void)> callback
Definition: eventq.hh:1118
void setCurTick(Tick newVal)
Definition: eventq.hh:1080
EventQueue * eventq
A pointer to this object's event queue.
Definition: eventq.hh:991
ScopedRelease(EventQueue *_eq)
Temporarily release the event queue service lock.
Definition: eventq.hh:730
Queue of events sorted in time order.
Definition: eventq.hh:623
Event * serviceOne()
Definition: eventq.cc:198
EventQueue(const EventQueue &)
Tick nextTick() const
Definition: eventq.hh:843
bool debugVerify() const
Definition: eventq.cc:314
void handleAsyncInsertions()
Function for moving events from the async_queue to the main queue.
Definition: eventq.cc:432
std::list< Event * > async_queue
List of events added by other threads to this event queue.
Definition: eventq.hh:635
void setCurTick(Tick newVal)
Definition: eventq.hh:844
void asyncInsert(Event *event)
Function for adding events to the async queue.
Definition: eventq.cc:424
Event * getHead() const
Definition: eventq.hh:858
std::string objName
Definition: eventq.hh:627
virtual ~EventQueue()
Definition: eventq.hh:971
void unlock()
Definition: eventq.hh:955
Event * head
Definition: eventq.hh:628
void lock()
Provide an interface for locking/unlocking the event queue.
Definition: eventq.hh:954
void checkpointReschedule(Event *event)
Reschedule an event after a checkpoint.
Definition: eventq.cc:280
friend void curEventQueue(EventQueue *)
Definition: eventq.hh:979
void insert(Event *event)
Insert / remove event from the queue.
Definition: eventq.cc:112
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
void remove(Event *event)
Definition: eventq.cc:166
UncontendedMutex async_queue_mutex
Mutex to protect async queue.
Definition: eventq.hh:632
UncontendedMutex service_mutex
Lock protecting event handling.
Definition: eventq.hh:657
const std::string name() const
Definition: eventq.hh:1107
const char * description() const
Return a C string describing the event.
Definition: eventq.hh:1112
EventWrapper(T *obj, bool del=false, Priority p=Default_Pri)
Definition: eventq.hh:1090
EventWrapper(T &obj, bool del=false, Priority p=Default_Pri)
Definition: eventq.hh:1097
Priority _priority
event priority
Definition: eventq.hh:272
virtual void process()=0
static Event * removeItem(Event *event, Event *last)
Definition: eventq.cc:135
virtual void acquireImpl()
Definition: eventq.hh:397
bool isFlagSet(Flags _flags) const
Definition: eventq.hh:321
Flags flags
Definition: eventq.hh:273
Event * nextBin
Definition: eventq.hh:265
void setWhen(Tick when, EventQueue *q)
Definition: eventq.hh:296
virtual void releaseImpl()
Definition: eventq.hh:399
EventQueue * queue
queue to which this event belongs (though it may or may not be scheduled on this queue yet)
Definition: eventq.hh:287
void acquire()
Memory management hooks for events that have the Managed flag set.
Definition: eventq.hh:383
Flags getFlags() const
Definition: eventq.hh:315
void clearFlags()
Definition: eventq.hh:342
static Event * insertBefore(Event *event, Event *curr)
Definition: eventq.cc:91
void release()
Managed event removed from the event queue.
Definition: eventq.hh:392
void setFlags(Flags _flags)
Definition: eventq.hh:328
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: eventq.cc:248
static Counter instanceCounter
Global counter to generate unique IDs for Event instances.
Definition: eventq.hh:277
Counter instance
This event's unique ID.
Definition: eventq.hh:283
Event(Priority p=Default_Pri, Flags f=0)
Definition: eventq.hh:414
bool initialized() const
Definition: eventq.hh:308
virtual BaseGlobalEvent * globalEvent()
If this is part of a GlobalEvent, return the pointer to the Global Event.
Definition: eventq.hh:520
Tick _when
timestamp when event should be processed
Definition: eventq.hh:271
Event * nextInBin
Definition: eventq.hh:266
const std::string instanceString() const
Return the instance number as a string.
Definition: eventq.cc:391
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: eventq.cc:239
void clearFlags(Flags _flags)
Definition: eventq.hh:335
Basic support for object serialization.
Definition: serialize.hh:170
STL list class.
Definition: stl.hh:51
STL vector class.
Definition: stl.hh:37
int8_t Priority
Definition: eventq.hh:123
EventManager(EventQueue *eq)
Definition: eventq.hh:1003
const char * description() const
Return a C string describing the event.
Definition: eventq.hh:1155
void dump() const
This is a debugging function which will print everything on the event queue.
Definition: eventq.cc:289
const std::string name() const
Definition: eventq.hh:1147
ScopedMigration(EventQueue *_new_eq, bool _doMigrate=true)
Temporarily migrate execution to a different event queue.
Definition: eventq.hh:689
void reschedule(Event *event, Tick when, bool always=false)
Reschedule the specified event.
Definition: eventq.hh:821
static const Priority Delayed_Writeback_Pri
For some reason "delayed" inter-cluster writebacks are scheduled before regular writebacks (which hav...
Definition: eventq.hh:172
void schedule(Event *event, Tick when, bool global=false)
Schedule the given event on this queue.
Definition: eventq.hh:764
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
virtual void trace(const char *action)
This function isn't really useful if TRACING_ON is not defined.
Definition: eventq.cc:379
void schedule(Event *event, Tick when)
Definition: eventq.hh:1046
void deschedule(Event *event)
Deschedule the specified event.
Definition: eventq.hh:797
void deschedule(Event &event)
Definition: eventq.hh:1028
static const Priority Maximum_Pri
Maximum priority.
Definition: eventq.hh:241
virtual ~Event()
Definition: eventq.cc:77
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
bool isAutoDelete() const
The function returns true if the object is automatically deleted after the event is processed.
Definition: eventq.hh:501
void name(const std::string &st)
Definition: eventq.hh:755
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
void serviceEvents(Tick when)
process all events up to the given timestamp.
Definition: eventq.hh:876
void deschedule(Event *event)
Definition: eventq.hh:1055
EventQueue * eventQueue() const
Definition: eventq.hh:1010
virtual const std::string name() const
Definition: eventq.hh:754
virtual const std::string name() const
Definition: eventq.cc:84
bool scheduled() const
Determine if the current event is scheduled.
Definition: eventq.hh:465
void reschedule(Event *event, Tick when, bool always=false)
Definition: eventq.hh:1064
void squash()
Squash the current event.
Definition: eventq.hh:472
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
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
void schedule(Event &event, Tick when)
Definition: eventq.hh:1019
EventManager(EventManager &em)
Event manger manages events in the event queue.
Definition: eventq.hh:1001
void dump() const
Dump the current event data.
Definition: eventq.cc:401
Priority priority() const
Get the event priority.
Definition: eventq.hh:515
bool isManaged() const
Check whether this event will auto-delete.
Definition: eventq.hh:493
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
EventManager(EventManager *em)
Definition: eventq.hh:1002
static const Priority Progress_Event_Pri
Progress events come at the end.
Definition: eventq.hh:226
void reschedule(Event &event, Tick when, bool always=false)
Definition: eventq.hh:1037
bool empty() const
Returns true if no events are queued.
Definition: eventq.hh:898
static const Priority CPU_Tick_Pri
CPU ticks must come after other associated CPU events (such as writebacks).
Definition: eventq.hh:204
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
virtual const char * description() const
Return a C string describing the event.
Definition: eventq.cc:373
Tick when() const
Get the time that the event is scheduled.
Definition: eventq.hh:508
static const Priority Default_Pri
Default is zero for historical reasons.
Definition: eventq.hh:179
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
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
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
static const Priority Stat_Event_Pri
Statistics events (dump, reset, etc.) come after everything else, but before exit.
Definition: eventq.hh:219
bool squashed() const
Check whether the event is squashed.
Definition: eventq.hh:479
static const Priority Minimum_Pri
Event priorities, to provide tie-breakers for events scheduled at the same cycle.
Definition: eventq.hh:135
bool isExitEvent() const
See if this is a SimExitEvent (without resorting to RTTI)
Definition: eventq.hh:486
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
void set(Type mask)
Set all flag's bits matching the given mask.
Definition: flags.hh:116
bool isSet(Type mask) const
Verifies whether any bit matching the given mask is set.
Definition: flags.hh:83
void clear()
Clear all flag's bits.
Definition: flags.hh:102
bool noneSet(Type mask) const
Verifies whether no bits matching the given mask are set.
Definition: flags.hh:99
Bitfield< 31 > n
Definition: misc_types.hh:462
Bitfield< 27 > q
Definition: misc_types.hh:55
Bitfield< 31, 28 > st
Definition: misc_types.hh:156
__thread Tick * _curTickPtr
Definition: cur_tick.cc:37
Bitfield< 10, 5 > event
Bitfield< 30, 0 > index
Bitfield< 29 > eq
Definition: misc.hh:58
Bitfield< 5 > r
Definition: pagetable.hh:60
Bitfield< 1 > s
Definition: pagetable.hh:64
Bitfield< 55 > l
Definition: pagetable.hh:54
Bitfield< 56 > f
Definition: pagetable.hh:53
Bitfield< 54 > p
Definition: pagetable.hh:70
Bitfield< 2 > em
Definition: misc.hh:607
double Counter
All counters are of 64-bit values.
Definition: types.hh:47
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Tick simQuantum
Simulation Quantum for multiple eventq simulation.
Definition: eventq.cc:48
bool operator>(const Time &l, const Time &r)
Definition: time.hh:233
static bool operator==(const PCStateBase &a, const PCStateBase &b)
Definition: pcstate.hh:155
Tick curTick()
The universal simulation clock.
Definition: cur_tick.hh:46
std::ostream CheckpointOut
Definition: serialize.hh:66
__thread EventQueue * _curEventQueue
The current event queue for the running thread.
Definition: eventq.cc:58
void dumpMainQueue()
Definition: eventq.cc:364
uint64_t Tick
Tick count type.
Definition: types.hh:58
EventQueue * curEventQueue()
Definition: eventq.hh:88
uint32_t numMainEventQueues
Current number of allocated main event queues.
Definition: eventq.cc:56
static bool operator!=(const PCStateBase &a, const PCStateBase &b)
Definition: pcstate.hh:161
bool operator>=(const Time &l, const Time &r)
Definition: time.hh:240
bool operator<(const Time &l, const Time &r)
Definition: time.hh:219
bool operator<=(const Time &l, const Time &r)
Definition: time.hh:226
bool inParallelMode
Current mode of execution: parallel / serial.
Definition: eventq.cc:59
EventQueue * getEventQueue(uint32_t index)
Function for returning eventq queue for the provided index.
Definition: eventq.cc:62
std::vector< EventQueue * > mainEventQueue
Array for main event queues.
Definition: eventq.cc:57

Generated on Wed Dec 21 2022 10:22:39 for gem5 by doxygen 1.9.1