40 .AddConstructor<CalendarScheduler> ()
76 std::cout <<
"Bucket Distribution ";
81 std::cout << std::endl;
101 Bucket::iterator end =
m_buckets[bucket].end ();
102 for (Bucket::iterator i =
m_buckets[bucket].begin (); i != end; ++i)
148 if (next.
key < minEvent.
key)
169 int32_t minBucket = -1;
172 minKey.
m_ts = uint64_t(-int64_t(1));
188 if (next.
key < minKey)
232 Bucket::iterator end =
m_buckets[bucket].end ();
233 for (Bucket::iterator i =
m_buckets[bucket].begin (); i != end; ++i)
294 std::list<Scheduler::Event> samples;
301 for (uint32_t i = 0; i < nSamples; i++)
306 for (std::list<Scheduler::Event>::const_iterator i = samples.begin ();
307 i != samples.end (); ++i)
318 uint64_t totalSeparation = 0;
319 std::list<Scheduler::Event>::const_iterator end = samples.end ();
320 std::list<Scheduler::Event>::const_iterator cur = samples.begin ();
321 std::list<Scheduler::Event>::const_iterator next = cur;
325 totalSeparation += next->key.m_ts - cur->key.m_ts;
329 uint64_t twiceAvg = totalSeparation / (nSamples - 1) * 2;
331 cur = samples.begin ();
336 uint64_t diff = next->key.m_ts - cur->key.m_ts;
337 if (diff <= twiceAvg)
339 totalSeparation += diff;
345 totalSeparation *= 3;
346 totalSeparation = std::max (totalSeparation, (uint64_t)1);
347 return totalSeparation;
358 for (uint32_t i = 0; i < oldNBuckets; i++)
360 Bucket::iterator end = oldBuckets[i].end ();
361 for (Bucket::iterator j = oldBuckets[i].begin (); j != end; ++j)
366 delete [] oldBuckets;
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
ns3::EventImpl declarations.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
uint32_t CalculateNewWidth(void)
void DoInsert(const Event &ev)
uint64_t m_ts
Event time stamp.
EventImpl * impl
Pointer to the event implementation.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
virtual Event PeekNext(void) const
virtual bool IsEmpty(void) const
virtual ~CalendarScheduler()
make Callback use a separate empty type
EventKey key
Key for sorting and ordering Events.
virtual void Remove(const Event &ev)
uint32_t m_uid
Event unique id.
void Init(uint32_t nBuckets, uint64_t width, uint64_t startPrio)
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
void Resize(uint32_t newSize)
virtual Event RemoveNext(void)
This method cannot be invoked if the list is empty.
Scheduler::Event DoRemoveNext(void)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void DoResize(uint32_t newSize, uint32_t newWidth)
std::list< Scheduler::Event > Bucket
static TypeId GetTypeId(void)
Structure for sorting and comparing Events.
uint32_t Hash(uint64_t key) const
virtual void Insert(const Event &ev)
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
uint32_t m_context
Event context.