eventq.hh (11015:f35e317d2e1e) eventq.hh (11072:6a447a3138ef)
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

--- 90 unchanged lines hidden (view full) ---

99 typedef unsigned short FlagsType;
100 typedef ::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 AutoDelete = 0x0004; // delete after dispatch
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

--- 90 unchanged lines hidden (view full) ---

99 typedef unsigned short FlagsType;
100 typedef ::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 AutoDelete = 0x0004; // delete after dispatch
107 static const FlagsType AutoSerialize = 0x0008; // must be serialized
107 /**
108 * This used to be AutoSerialize. This value can't be reused
109 * without changing the checkpoint version since the flag field
110 * gets serialized.
111 */
112 static const FlagsType Reserved0 = 0x0008;
108 static const FlagsType IsExitEvent = 0x0010; // special exit event
109 static const FlagsType IsMainQueue = 0x0020; // on main event queue
110 static const FlagsType Initialized = 0x7a40; // somewhat random bits
111 static const FlagsType InitMask = 0xffc0; // mask for init bits
112
113 public:
114 typedef int8_t Priority;
115

--- 316 unchanged lines hidden (view full) ---

432 * deterministic. This causes the event to be inserted in a separate
433 * queue of asynchronous events (async_queue), which is merged main
434 * event queue at the end of each simulation quantum (by calling the
435 * handleAsyncInsertions() method). Note that this implies that such
436 * events must happen at least one simulation quantum into the future,
437 * otherwise they risk being scheduled in the past by
438 * handleAsyncInsertions().
439 */
113 static const FlagsType IsExitEvent = 0x0010; // special exit event
114 static const FlagsType IsMainQueue = 0x0020; // on main event queue
115 static const FlagsType Initialized = 0x7a40; // somewhat random bits
116 static const FlagsType InitMask = 0xffc0; // mask for init bits
117
118 public:
119 typedef int8_t Priority;
120

--- 316 unchanged lines hidden (view full) ---

437 * deterministic. This causes the event to be inserted in a separate
438 * queue of asynchronous events (async_queue), which is merged main
439 * event queue at the end of each simulation quantum (by calling the
440 * handleAsyncInsertions() method). Note that this implies that such
441 * events must happen at least one simulation quantum into the future,
442 * otherwise they risk being scheduled in the past by
443 * handleAsyncInsertions().
444 */
440class EventQueue : public Serializable
445class EventQueue
441{
442 private:
443 std::string objName;
444 Event *head;
445 Tick _curTick;
446
447 //! Mutex to protect async queue.
448 std::mutex async_queue_mutex;

--- 189 unchanged lines hidden (view full) ---

638 * @see EventQueue::ScopedMigration.
639 * @see EventQueue::ScopedRelease
640 * @see EventQueue
641 */
642 void lock() { service_mutex.lock(); }
643 void unlock() { service_mutex.unlock(); }
644 /**@}*/
645
446{
447 private:
448 std::string objName;
449 Event *head;
450 Tick _curTick;
451
452 //! Mutex to protect async queue.
453 std::mutex async_queue_mutex;

--- 189 unchanged lines hidden (view full) ---

643 * @see EventQueue::ScopedMigration.
644 * @see EventQueue::ScopedRelease
645 * @see EventQueue
646 */
647 void lock() { service_mutex.lock(); }
648 void unlock() { service_mutex.unlock(); }
649 /**@}*/
650
646#ifndef SWIG
647 void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE;
648 void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE;
649#endif
650
651 /**
652 * Reschedule an event after a checkpoint.
653 *
654 * Since events don't know which event queue they belong to,
655 * parent objects need to reschedule events themselves. This
656 * method conditionally schedules an event that has the Scheduled
657 * flag set. It should be called by parent objects after
658 * unserializing an object.

--- 126 unchanged lines hidden ---
651 /**
652 * Reschedule an event after a checkpoint.
653 *
654 * Since events don't know which event queue they belong to,
655 * parent objects need to reschedule events themselves. This
656 * method conditionally schedules an event that has the Scheduled
657 * flag set. It should be called by parent objects after
658 * unserializing an object.

--- 126 unchanged lines hidden ---