53                            .AddAttribute(
"Reverse",
 
   54                                          "Store events in reverse chronological order",
 
   86        Pop = [](
Bucket& bucket) -> 
void { bucket.pop_back(); };
 
   92        Pop = [](
Bucket& bucket) -> 
void { bucket.pop_front(); };
 
  114    std::cout << 
"Bucket Distribution ";
 
  119    std::cout << std::endl;
 
  140    Bucket::iterator end = 
m_buckets[bucket].end();
 
  141    for (Bucket::iterator i = 
m_buckets[bucket].begin(); i != end; ++i)
 
  176    minEvent.
impl = 
nullptr;
 
  177    minEvent.
key.
m_ts = UINT64_MAX;
 
  189            if (next.
key < minEvent.
key)
 
  212    minKey.
m_ts = uint64_t(-int64_t(1));
 
  228            if (next.
key < minKey)
 
  270    Bucket::iterator end = 
m_buckets[bucket].end();
 
  271    for (Bucket::iterator i = 
m_buckets[bucket].begin(); i != end; ++i)
 
  332    std::list<Scheduler::Event> samples;
 
  339    for (
uint32_t i = 0; i < nSamples; i++)
 
  344    for (std::list<Scheduler::Event>::const_iterator i = samples.begin(); i != samples.end(); ++i)
 
  355    uint64_t totalSeparation = 0;
 
  356    std::list<Scheduler::Event>::const_iterator end = samples.end();
 
  357    std::list<Scheduler::Event>::const_iterator cur = samples.begin();
 
  358    std::list<Scheduler::Event>::const_iterator next = cur;
 
  362        totalSeparation += next->key.m_ts - cur->key.m_ts;
 
  366    uint64_t twiceAvg = totalSeparation / (nSamples - 1) * 2;
 
  368    cur = samples.begin();
 
  373        uint64_t diff = next->key.m_ts - cur->key.m_ts;
 
  374        if (diff <= twiceAvg)
 
  376            totalSeparation += diff;
 
  382    totalSeparation *= 3;
 
  383    totalSeparation = std::max(totalSeparation, (uint64_t)1);
 
  384    return totalSeparation;
 
  396    for (
uint32_t i = 0; i < oldNBuckets; i++)
 
  398        Bucket::iterator end = oldBuckets[i].end();
 
  399        for (Bucket::iterator j = oldBuckets[i].begin(); j != end; ++j)
 
NS_ASSERT() and NS_ASSERT_MSG() macro definitions.
 
ns3::BooleanValue attribute value declarations.
 
ns3::CalendarScheduler class declaration.
 
AttributeValue implementation for Boolean.
 
a calendar queue event scheduler
 
bool m_reverse
Bucket ordering.
 
uint64_t CalculateNewWidth()
Compute the new bucket size, based on up to the first 25 entries.
 
uint32_t m_nBuckets
Number of buckets in the array.
 
bool(* Order)(const EventKey &newEvent, const EventKey &it)
Ordering function to identify the insertion point, according to m_reverse.
 
void PrintInfo()
Print the configuration and bucket size distribution.
 
uint32_t m_qSize
Number of events in queue.
 
Scheduler::Event &(* NextEvent)(Bucket &bucket)
Get the next event from the bucket, according to m_reverse.
 
void Remove(const Scheduler::Event &ev) override
Remove a specific event from the event list.
 
void Init(uint32_t nBuckets, uint64_t width, uint64_t startPrio)
Initialize the calendar queue.
 
void ResizeDown()
Halve the number of buckets if necessary.
 
uint32_t Hash(uint64_t key) const
Hash the dimensionless time to a bucket.
 
void Insert(const Scheduler::Event &ev) override
Insert a new Event in the schedule.
 
void DoInsert(const Scheduler::Event &ev)
Insert a new event in to the correct bucket.
 
uint64_t m_bucketTop
Priority at the top of the bucket from which last event was dequeued.
 
CalendarScheduler()
Constructor.
 
std::list< Scheduler::Event > Bucket
Calendar bucket type: a list of Events.
 
~CalendarScheduler() override
Destructor.
 
void DoResize(uint32_t newSize, uint64_t newWidth)
Resize the number of buckets and width.
 
Scheduler::Event PeekNext() const override
Get a pointer to the next event.
 
Scheduler::Event RemoveNext() override
Remove the earliest event from the event list.
 
Scheduler::Event DoRemoveNext()
Remove the earliest event.
 
uint32_t m_lastBucket
Bucket index from which the last event was dequeued.
 
void SetReverse(bool reverse)
Set the insertion order.
 
void Resize(uint32_t newSize)
Resize to a new number of buckets, with automatically computed width.
 
bool IsEmpty() const override
Test if the schedule is empty.
 
uint64_t m_lastPrio
The priority of the last event removed.
 
uint64_t m_width
Duration of a bucket, in dimensionless time units.
 
void ResizeUp()
Double the number of buckets if necessary.
 
Bucket * m_buckets
Array of buckets.
 
void(* Pop)(Bucket &)
Pop the next event from the bucket, according to m_reverse.
 
static TypeId GetTypeId()
Register this type.
 
a unique identifier for an interface.
 
@ ATTR_CONSTRUCT
The attribute can be written at construction-time.
 
TypeId SetParent(TypeId tid)
Set the parent TypeId.
 
ns3::EventImpl declarations.
 
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
 
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
 
Ptr< const AttributeChecker > MakeBooleanChecker()
 
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
 
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
 
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
 
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
 
Every class exported by the ns3 library is enclosed in the ns3 namespace.
 
EventKey key
Key for sorting and ordering Events.
 
EventImpl * impl
Pointer to the event implementation.
 
Structure for sorting and comparing Events.
 
uint32_t m_context
Event context.
 
uint64_t m_ts
Event time stamp.
 
uint32_t m_uid
Event unique id.
 
ns3::TypeId declaration; inline and template implementations.