gem5  v20.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 <memory>
44 #include <mutex>
45 #include <string>
46 
47 #include "base/debug.hh"
48 #include "base/flags.hh"
49 #include "base/types.hh"
50 #include "debug/Event.hh"
51 #include "sim/serialize.hh"
52 
53 class EventQueue; // forward declaration
54 class BaseGlobalEvent;
55 
61 extern Tick simQuantum;
62 
64 extern uint32_t numMainEventQueues;
65 
68 
71 
72 extern __thread EventQueue *_curEventQueue;
73 
75 extern bool inParallelMode;
76 
81 EventQueue *getEventQueue(uint32_t index);
82 
85 
91 class EventBase
92 {
93  protected:
94  typedef unsigned short FlagsType;
95  typedef ::Flags<FlagsType> Flags;
96 
97  static const FlagsType PublicRead = 0x003f; // public readable flags
98  static const FlagsType PublicWrite = 0x001d; // public writable flags
99  static const FlagsType Squashed = 0x0001; // has been squashed
100  static const FlagsType Scheduled = 0x0002; // has been scheduled
101  static const FlagsType Managed = 0x0004; // Use life cycle manager
102  static const FlagsType AutoDelete = Managed; // delete after dispatch
108  static const FlagsType Reserved0 = 0x0008;
109  static const FlagsType IsExitEvent = 0x0010; // special exit event
110  static const FlagsType IsMainQueue = 0x0020; // on main event queue
111  static const FlagsType Initialized = 0x7a40; // somewhat random bits
112  static const FlagsType InitMask = 0xffc0; // mask for init bits
113 
114  public:
118  typedef int8_t Priority;
119 
124 
130  static const Priority Minimum_Pri = SCHAR_MIN;
131 
139  static const Priority Debug_Enable_Pri = -101;
140 
148  static const Priority Debug_Break_Pri = -100;
149 
158  static const Priority CPU_Switch_Pri = -31;
159 
167  static const Priority Delayed_Writeback_Pri = -1;
168 
174  static const Priority Default_Pri = 0;
175 
182  static const Priority DVFS_Update_Pri = 31;
183 
191  static const Priority Serialize_Pri = 32;
192 
199  static const Priority CPU_Tick_Pri = 50;
200 
206  static const Priority CPU_Exit_Pri = 64;
207 
214  static const Priority Stat_Event_Pri = 90;
215 
221  static const Priority Progress_Event_Pri = 95;
222 
229  static const Priority Sim_Exit_Pri = 100;
230 
236  static const Priority Maximum_Pri = SCHAR_MAX;
237 };
238 
239 /*
240  * An item on an event queue. The action caused by a given
241  * event is specified by deriving a subclass and overriding the
242  * process() member function.
243  *
244  * Caution, the order of members is chosen to maximize data packing.
245  */
246 class Event : public EventBase, public Serializable
247 {
248  friend class EventQueue;
249 
250  private:
251  // The event queue is now a linked list of linked lists. The
252  // 'nextBin' pointer is to find the bin, where a bin is defined as
253  // when+priority. All events in the same bin will be stored in a
254  // second linked list (a stack) maintained by the 'nextInBin'
255  // pointer. The list will be accessed in LIFO order. The end
256  // result is that the insert/removal in 'nextBin' is
257  // linear/constant, and the lookup/removal in 'nextInBin' is
258  // constant/constant. Hopefully this is a significant improvement
259  // over the current fully linear insertion.
262 
263  static Event *insertBefore(Event *event, Event *curr);
264  static Event *removeItem(Event *event, Event *last);
265 
269 
270 #ifndef NDEBUG
271  static Counter instanceCounter;
273 
279 
283 #endif
284 
285 #ifdef EVENTQ_DEBUG
286  Tick whenCreated;
287  Tick whenScheduled;
288 #endif
289 
290  void
292  {
293  _when = when;
294 #ifndef NDEBUG
295  queue = q;
296 #endif
297 #ifdef EVENTQ_DEBUG
298  whenScheduled = curTick();
299 #endif
300  }
301 
302  bool
303  initialized() const
304  {
305  return (flags & InitMask) == Initialized;
306  }
307 
308  protected:
309  Flags
310  getFlags() const
311  {
312  return flags & PublicRead;
313  }
314 
315  bool
316  isFlagSet(Flags _flags) const
317  {
318  assert(_flags.noneSet(~PublicRead));
319  return flags.isSet(_flags);
320  }
321 
322  void
323  setFlags(Flags _flags)
324  {
325  assert(_flags.noneSet(~PublicWrite));
326  flags.set(_flags);
327  }
328 
329  void
331  {
332  assert(_flags.noneSet(~PublicWrite));
333  flags.clear(_flags);
334  }
335 
336  void
338  {
340  }
341 
347  virtual void trace(const char *action);
348 
350  const std::string instanceString() const;
351 
352  protected: /* Memory management */
378  void acquire()
379  {
381  acquireImpl();
382  }
383 
387  void release() {
389  releaseImpl();
390  }
391 
392  virtual void acquireImpl() {}
393 
394  virtual void releaseImpl() {
395  if (!scheduled())
396  delete this;
397  }
398 
401  public:
402 
403  /*
404  * Event constructor
405  * @param queue that the event gets scheduled on
406  *
407  * @ingroup api_eventq
408  */
410  : nextBin(nullptr), nextInBin(nullptr), _when(0), _priority(p),
411  flags(Initialized | f)
412  {
413  assert(f.noneSet(~PublicWrite));
414 #ifndef NDEBUG
416  queue = NULL;
417 #endif
418 #ifdef EVENTQ_DEBUG
419  whenCreated = curTick();
420  whenScheduled = 0;
421 #endif
422  }
423 
428  virtual ~Event();
429  virtual const std::string name() const;
430 
434  virtual const char *description() const;
435 
437  void dump() const; //end of api group
439 
440  public:
441  /*
442  * This member function is invoked when the event is processed
443  * (occurs). There is no default implementation; each subclass
444  * must provide its own implementation. The event is not
445  * automatically deleted after it is processed (to allow for
446  * statically allocated event objects).
447  *
448  * If the AutoDestroy flag is set, the object is deleted once it
449  * is processed.
450  *
451  * @ingroup api_eventq
452  */
453  virtual void process() = 0;
454 
460  bool scheduled() const { return flags.isSet(Scheduled); }
461 
467  void squash() { flags.set(Squashed); }
468 
474  bool squashed() const { return flags.isSet(Squashed); }
475 
481  bool isExitEvent() const { return flags.isSet(IsExitEvent); }
482 
488  bool isManaged() const { return flags.isSet(Managed); }
489 
496  bool isAutoDelete() const { return isManaged(); }
497 
503  Tick when() const { return _when; }
504 
510  Priority priority() const { return _priority; }
511 
515  virtual BaseGlobalEvent *globalEvent() { return NULL; }
516 
517  void serialize(CheckpointOut &cp) const override;
518  void unserialize(CheckpointIn &cp) override;
519 };
520 
524 inline bool
525 operator<(const Event &l, const Event &r)
526 {
527  return l.when() < r.when() ||
528  (l.when() == r.when() && l.priority() < r.priority());
529 }
530 
534 inline bool
535 operator>(const Event &l, const Event &r)
536 {
537  return l.when() > r.when() ||
538  (l.when() == r.when() && l.priority() > r.priority());
539 }
540 
544 inline bool
545 operator<=(const Event &l, const Event &r)
546 {
547  return l.when() < r.when() ||
548  (l.when() == r.when() && l.priority() <= r.priority());
549 }
550 
554 inline bool
555 operator>=(const Event &l, const Event &r)
556 {
557  return l.when() > r.when() ||
558  (l.when() == r.when() && l.priority() >= r.priority());
559 }
560 
564 inline bool
565 operator==(const Event &l, const Event &r)
566 {
567  return l.when() == r.when() && l.priority() == r.priority();
568 }
569 
573 inline bool
574 operator!=(const Event &l, const Event &r)
575 {
576  return l.when() != r.when() || l.priority() != r.priority();
577 }
578 
618 {
619  private:
620  std::string objName;
623 
625  std::mutex async_queue_mutex;
626 
629 
650  std::mutex service_mutex;
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 (DTRACE(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 (DTRACE(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 (DTRACE(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(); }
948  void unlock() { service_mutex.unlock(); }
963 
964  virtual ~EventQueue()
965  {
966  while (!empty())
967  deschedule(getHead());
968  }
969 };
970 
971 void dumpMainQueue();
972 
974 {
975  protected:
978 
979  public:
989  EventManager(EventQueue *eq) : eventq(eq) {} //end of api_eventq group
991 
995  EventQueue *
996  eventQueue() const
997  {
998  return eventq;
999  }
1000 
1004  void
1006  {
1007  eventq->schedule(&event, when);
1008  }
1009 
1013  void
1015  {
1016  eventq->deschedule(&event);
1017  }
1018 
1022  void
1023  reschedule(Event &event, Tick when, bool always = false)
1024  {
1025  eventq->reschedule(&event, when, always);
1026  }
1027 
1031  void
1033  {
1034  eventq->schedule(event, when);
1035  }
1036 
1040  void
1042  {
1044  }
1045 
1049  void
1050  reschedule(Event *event, Tick when, bool always = false)
1051  {
1052  eventq->reschedule(event, when, always);
1053  }
1054 
1061  void wakeupEventQueue(Tick when = (Tick)-1)
1062  {
1063  eventq->wakeup(when);
1064  }
1065 
1066  void setCurTick(Tick newVal) { eventq->setCurTick(newVal); }
1067 };
1068 
1069 template <class T, void (T::* F)()>
1070 class EventWrapper : public Event
1071 {
1072  private:
1074 
1075  public:
1076  EventWrapper(T *obj, bool del = false, Priority p = Default_Pri)
1077  : Event(p), object(obj)
1078  {
1079  if (del)
1081  }
1082 
1083  EventWrapper(T &obj, bool del = false, Priority p = Default_Pri)
1084  : Event(p), object(&obj)
1085  {
1086  if (del)
1088  }
1089 
1090  void process() { (object->*F)(); }
1091 
1092  const std::string
1093  name() const
1094  {
1095  return object->name() + ".wrapped_event";
1096  }
1097 
1098  const char *description() const { return "EventWrapped"; }
1099 };
1100 
1102 {
1103  private:
1104  std::function<void(void)> callback;
1105  std::string _name;
1106 
1107  public:
1114  EventFunctionWrapper(const std::function<void(void)> &callback,
1115  const std::string &name,
1116  bool del = false,
1119  {
1120  if (del)
1122  }
1123 
1127  void process() { callback(); }
1128 
1132  const std::string
1133  name() const
1134  {
1135  return _name + ".wrapped_function_event";
1136  }
1137 
1141  const char *description() const { return "EventFunctionWrapped"; }
1142 };
1143 
1144 #endif // __SIM_EVENTQ_HH__
EventWrapper::EventWrapper
EventWrapper(T *obj, bool del=false, Priority p=Default_Pri)
Definition: eventq.hh:1076
EventWrapper::description
const char * description() const
Return a C string describing the event.
Definition: eventq.hh:1098
EventQueue::ScopedMigration::~ScopedMigration
~ScopedMigration()
Definition: eventq.hh:693
Event::_priority
Priority _priority
event priority
Definition: eventq.hh:267
Event::scheduled
bool scheduled() const
Determine if the current event is scheduled.
Definition: eventq.hh:460
EventBase::AutoDelete
static const FlagsType AutoDelete
Definition: eventq.hh:102
EventQueue::debugVerify
bool debugVerify() const
Definition: eventq.cc:313
Event::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: eventq.cc:247
Event::nextBin
Event * nextBin
Definition: eventq.hh:260
EventQueue::ScopedMigration::ScopedMigration
ScopedMigration(EventQueue *_new_eq, bool _doMigrate=true)
Temporarily migrate execution to a different event queue.
Definition: eventq.hh:682
EventQueue::ScopedMigration::doMigrate
bool doMigrate
Definition: eventq.hh:705
EventQueue::name
virtual const std::string name() const
Definition: eventq.hh:747
EventQueue::serviceOne
Event * serviceOne()
Definition: eventq.cc:197
EventWrapper::EventWrapper
EventWrapper(T &obj, bool del=false, Priority p=Default_Pri)
Definition: eventq.hh:1083
Event::instance
Counter instance
This event's unique ID.
Definition: eventq.hh:278
EventQueue::unlock
void unlock()
Definition: eventq.hh:948
EventQueue::async_queue_mutex
std::mutex async_queue_mutex
Mutex to protect async queue.
Definition: eventq.hh:625
Flags::noneSet
bool noneSet() const
Definition: flags.hh:83
Event::insertBefore
static Event * insertBefore(Event *event, Event *curr)
Definition: eventq.cc:90
EventQueue::reschedule
void reschedule(Event *event, Tick when, bool always=false)
Reschedule the specified event.
Definition: eventq.hh:814
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:199
MipsISA::index
Bitfield< 30, 0 > index
Definition: pra_constants.hh:44
serialize.hh
EventManager::reschedule
void reschedule(Event *event, Tick when, bool always=false)
Definition: eventq.hh:1050
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:214
Event::_when
Tick _when
timestamp when event should be processed
Definition: eventq.hh:266
EventQueue::checkpointReschedule
void checkpointReschedule(Event *event)
Reschedule an event after a checkpoint.
Definition: eventq.cc:279
EventBase::InitMask
static const FlagsType InitMask
Definition: eventq.hh:112
Event::isExitEvent
bool isExitEvent() const
See if this is a SimExitEvent (without resorting to RTTI)
Definition: eventq.hh:481
Event::squashed
bool squashed() const
Check whether the event is squashed.
Definition: eventq.hh:474
EventManager::reschedule
void reschedule(Event &event, Tick when, bool always=false)
Definition: eventq.hh:1023
EventBase::Scheduled
static const FlagsType Scheduled
Definition: eventq.hh:100
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:355
Event::setWhen
void setWhen(Tick when, EventQueue *q)
Definition: eventq.hh:291
EventManager::schedule
void schedule(Event *event, Tick when)
Definition: eventq.hh:1032
Flags< FlagsType >
EventQueue::async_queue
std::list< Event * > async_queue
List of events added by other threads to this event queue.
Definition: eventq.hh:628
operator==
bool operator==(const Event &l, const Event &r)
Definition: eventq.hh:565
Serializable
Basic support for object serialization.
Definition: serialize.hh:172
Event::acquireImpl
virtual void acquireImpl()
Definition: eventq.hh:392
EventQueue::ScopedRelease::eq
EventQueue & eq
Definition: eventq.hh:735
EventWrapper
Definition: eventq.hh:1070
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:63
ArmISA::q
Bitfield< 27 > q
Definition: miscregs_types.hh:52
numMainEventQueues
uint32_t numMainEventQueues
Current number of allocated main event queues.
Definition: eventq.cc:55
Event::dump
void dump() const
Dump the current event data.
Definition: eventq.cc:404
operator!=
bool operator!=(const Event &l, const Event &r)
Definition: eventq.hh:574
EventQueue::getHead
Event * getHead() const
Definition: eventq.hh:851
operator<=
bool operator<=(const Event &l, const Event &r)
Definition: eventq.hh:545
DTRACE
#define DTRACE(x)
Definition: debug.hh:146
EventBase::IsExitEvent
static const FlagsType IsExitEvent
Definition: eventq.hh:109
EventManager::deschedule
void deschedule(Event &event)
Definition: eventq.hh:1014
std::vector
STL vector class.
Definition: stl.hh:37
EventQueue::dump
void dump() const
This is a debugging function which will print everything on the event queue.
Definition: eventq.cc:288
Event::flags
Flags flags
Definition: eventq.hh:268
Event::description
virtual const char * description() const
Return a C string describing the event.
Definition: eventq.cc:372
EventBase::IsMainQueue
static const FlagsType IsMainQueue
Definition: eventq.hh:110
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
Event::when
Tick when() const
Get the time that the event is scheduled.
Definition: eventq.hh:503
getEventQueue
EventQueue * getEventQueue(uint32_t index)
Function for returning eventq queue for the provided index.
Definition: eventq.cc:61
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:167
operator<
bool operator<(const Event &l, const Event &r)
Definition: eventq.hh:525
EventQueue::_curTick
Tick _curTick
Definition: eventq.hh:622
simQuantum
Tick simQuantum
Simulation Quantum for multiple eventq simulation.
Definition: eventq.cc:47
EventQueue::ScopedRelease
Definition: eventq.hh:709
Event::process
virtual void process()=0
EventQueue::ScopedMigration::new_eq
EventQueue & new_eq
Definition: eventq.hh:703
EventQueue::ScopedRelease::ScopedRelease
ScopedRelease(EventQueue *_eq)
Temporarily release the event queue service lock.
Definition: eventq.hh:723
EventQueue::nextTick
Tick nextTick() const
Definition: eventq.hh:836
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
EventFunctionWrapper
Definition: eventq.hh:1101
EventBase::PublicRead
static const FlagsType PublicRead
Definition: eventq.hh:97
EventQueue::name
void name(const std::string &st)
Definition: eventq.hh:748
EventBase::Managed
static const FlagsType Managed
Definition: eventq.hh:101
ArmISA::n
Bitfield< 31 > n
Definition: miscregs_types.hh:450
EventBase::Flags
::Flags< FlagsType > Flags
Definition: eventq.hh:95
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:206
Counter
int64_t Counter
Statistics counter type.
Definition: types.hh:58
cp
Definition: cprintf.cc:40
EventManager::schedule
void schedule(Event &event, Tick when)
Definition: eventq.hh:1005
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:229
Event::acquire
void acquire()
Memory management hooks for events that have the Managed flag set.
Definition: eventq.hh:378
EventBase::Minimum_Pri
static const Priority Minimum_Pri
Event priorities, to provide tie-breakers for events scheduled at the same cycle.
Definition: eventq.hh:130
operator>
bool operator>(const Event &l, const Event &r)
Definition: eventq.hh:535
Flags::clear
void clear()
Definition: flags.hh:85
Event
Definition: eventq.hh:246
EventBase::Reserved0
static const FlagsType Reserved0
This used to be AutoSerialize.
Definition: eventq.hh:108
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:1114
EventManager::EventManager
EventManager(EventQueue *eq)
Definition: eventq.hh:989
Event::clearFlags
void clearFlags()
Definition: eventq.hh:337
EventBase::FlagsType
unsigned short FlagsType
Definition: eventq.hh:94
EventQueue::ScopedRelease::~ScopedRelease
~ScopedRelease()
Definition: eventq.hh:729
Event::nextInBin
Event * nextInBin
Definition: eventq.hh:261
EventManager::setCurTick
void setCurTick(Tick newVal)
Definition: eventq.hh:1066
MipsISA::event
Bitfield< 10, 5 > event
Definition: pra_constants.hh:297
EventBase::DVFS_Update_Pri
static const Priority DVFS_Update_Pri
DVFS update event leads to stats dump therefore given a lower priority to ensure all relevant states ...
Definition: eventq.hh:182
ArmISA::st
Bitfield< 31, 28 > st
Definition: miscregs_types.hh:152
EventQueue::empty
bool empty() const
Returns true if no events are queued.
Definition: eventq.hh:891
MipsISA::r
r
Definition: pra_constants.hh:95
EventQueue::serviceEvents
void serviceEvents(Tick when)
process all events up to the given timestamp.
Definition: eventq.hh:869
inParallelMode
bool inParallelMode
Current mode of execution: parallel / serial.
Definition: eventq.cc:58
Event::setFlags
void setFlags(Flags _flags)
Definition: eventq.hh:323
Event::isManaged
bool isManaged() const
Check whether this event will auto-delete.
Definition: eventq.hh:488
EventQueue::handleAsyncInsertions
void handleAsyncInsertions()
Function for moving events from the async_queue to the main queue.
Definition: eventq.cc:435
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:139
debug.hh
EventWrapper::object
T * object
Definition: eventq.hh:1073
Event::trace
virtual void trace(const char *action)
This function isn't really useful if TRACING_ON is not defined.
Definition: eventq.cc:378
Event::initialized
bool initialized() const
Definition: eventq.hh:303
X86ISA::em
Bitfield< 2 > em
Definition: misc.hh:602
curEventQueue
EventQueue * curEventQueue()
Definition: eventq.hh:83
Flags::set
void set(Type flags)
Definition: flags.hh:87
EventBase::Maximum_Pri
static const Priority Maximum_Pri
Maximum priority.
Definition: eventq.hh:236
Event::isFlagSet
bool isFlagSet(Flags _flags) const
Definition: eventq.hh:316
EventQueue::asyncInsert
void asyncInsert(Event *event)
Function for adding events to the async queue.
Definition: eventq.cc:427
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:191
Event::instanceString
const std::string instanceString() const
Return the instance number as a string.
Definition: eventq.cc:394
Event::priority
Priority priority() const
Get the event priority.
Definition: eventq.hh:510
EventBase::PublicWrite
static const FlagsType PublicWrite
Definition: eventq.hh:98
EventQueue::~EventQueue
virtual ~EventQueue()
Definition: eventq.hh:964
EventQueue::setCurTick
void setCurTick(Tick newVal)
Definition: eventq.hh:837
EventQueue::insert
void insert(Event *event)
Insert / remove event from the queue.
Definition: eventq.cc:111
EventManager::eventQueue
EventQueue * eventQueue() const
Definition: eventq.hh:996
Event::clearFlags
void clearFlags(Flags _flags)
Definition: eventq.hh:330
Event::globalEvent
virtual BaseGlobalEvent * globalEvent()
If this is part of a GlobalEvent, return the pointer to the Global Event.
Definition: eventq.hh:515
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:148
flags.hh
Event::releaseImpl
virtual void releaseImpl()
Definition: eventq.hh:394
EventFunctionWrapper::process
void process()
Definition: eventq.hh:1127
EventFunctionWrapper::description
const char * description() const
Return a C string describing the event.
Definition: eventq.hh:1141
EventQueue::schedule
void schedule(Event *event, Tick when, bool global=false)
Schedule the given event on this queue.
Definition: eventq.hh:757
EventQueue::lock
void lock()
Provide an interface for locking/unlocking the event queue.
Definition: eventq.hh:947
Event::release
void release()
Managed event removed from the event queue.
Definition: eventq.hh:387
EventQueue::ScopedMigration
Definition: eventq.hh:665
EventQueue::objName
std::string objName
Definition: eventq.hh:620
Event::isAutoDelete
bool isAutoDelete() const
The function returns true if the object is automatically deleted after the event is processed.
Definition: eventq.hh:496
PowerISA::eq
Bitfield< 29 > eq
Definition: miscregs.hh:48
EventBase::CPU_Switch_Pri
static const Priority CPU_Switch_Pri
CPU switches schedule the new CPU's tick event for the same cycle (after unscheduling the old CPU's t...
Definition: eventq.hh:158
Event::getFlags
Flags getFlags() const
Definition: eventq.hh:310
types.hh
EventQueue::remove
void remove(Event *event)
Definition: eventq.cc:165
operator>=
bool operator>=(const Event &l, const Event &r)
Definition: eventq.hh:555
EventQueue::deschedule
void deschedule(Event *event)
Deschedule the specified event.
Definition: eventq.hh:790
EventBase::Default_Pri
static const Priority Default_Pri
Default is zero for historical reasons.
Definition: eventq.hh:174
EventManager::eventq
EventQueue * eventq
A pointer to this object's event queue.
Definition: eventq.hh:977
Event::squash
void squash()
Squash the current event.
Definition: eventq.hh:467
Event::removeItem
static Event * removeItem(Event *event, Event *last)
Definition: eventq.cc:134
EventManager::deschedule
void deschedule(Event *event)
Definition: eventq.hh:1041
EventBase
Common base class for Event and GlobalEvent, so they can share flag and priority definitions and acce...
Definition: eventq.hh:91
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:1061
CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:63
EventBase::Squashed
static const FlagsType Squashed
Definition: eventq.hh:99
EventWrapper::process
void process()
Definition: eventq.hh:1090
EventManager
Definition: eventq.hh:973
EventQueue::ScopedMigration::old_eq
EventQueue & old_eq
Definition: eventq.hh:704
EventFunctionWrapper::_name
std::string _name
Definition: eventq.hh:1105
Event::Event
Event(Priority p=Default_Pri, Flags f=0)
Definition: eventq.hh:409
Flags::isSet
bool isSet() const
Definition: flags.hh:79
EventBase::Priority
int8_t Priority
Definition: eventq.hh:118
EventQueue
Queue of events sorted in time order.
Definition: eventq.hh:617
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
std::list< Event * >
EventQueue::EventQueue
EventQueue(const EventQueue &)
EventBase::Progress_Event_Pri
static const Priority Progress_Event_Pri
Progress events come at the end.
Definition: eventq.hh:221
EventFunctionWrapper::name
const std::string name() const
Definition: eventq.hh:1133
ArmISA::s
Bitfield< 4 > s
Definition: miscregs_types.hh:556
EventManager::EventManager
EventManager(EventManager *em)
Definition: eventq.hh:988
CheckpointIn
Definition: serialize.hh:67
MipsISA::l
Bitfield< 5 > l
Definition: pra_constants.hh:320
Event::name
virtual const std::string name() const
Definition: eventq.cc:83
EventFunctionWrapper::callback
std::function< void(void)> callback
Definition: eventq.hh:1104
BaseGlobalEvent
Common base class for GlobalEvent and GlobalSyncEvent.
Definition: global_event.hh:60
EventWrapper::name
const std::string name() const
Definition: eventq.hh:1093
dumpMainQueue
void dumpMainQueue()
Definition: eventq.cc:363
EventQueue::head
Event * head
Definition: eventq.hh:621
mainEventQueue
std::vector< EventQueue * > mainEventQueue
Array for main event queues.
Definition: eventq.cc:56
Event::~Event
virtual ~Event()
Definition: eventq.cc:76
EventBase::Initialized
static const FlagsType Initialized
Definition: eventq.hh:111
EventQueue::service_mutex
std::mutex service_mutex
Lock protecting event handling.
Definition: eventq.hh:650
Event::instanceCounter
static Counter instanceCounter
Global counter to generate unique IDs for Event instances.
Definition: eventq.hh:272
Event::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: eventq.cc:238
ArmISA::f
Bitfield< 6 > f
Definition: miscregs_types.hh:64
EventManager::EventManager
EventManager(EventManager &em)
Event manger manages events in the event queue.
Definition: eventq.hh:987
curTick
Tick curTick()
The current simulated tick.
Definition: core.hh:45
_curEventQueue
__thread EventQueue * _curEventQueue
The current event queue for the running thread.
Definition: eventq.cc:57
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:282

Generated on Wed Sep 30 2020 14:02:14 for gem5 by doxygen 1.8.17