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)
uint32_t CalculateNewWidth(void)
void DoInsert(const Event &ev)
#define NS_ASSERT(condition)
virtual Event PeekNext(void) const
virtual bool IsEmpty(void) const
virtual ~CalendarScheduler()
make Callback use a separate empty type
virtual void Remove(const Event &ev)
NS_OBJECT_ENSURE_REGISTERED(AntennaModel)
void Init(uint32_t nBuckets, uint64_t width, uint64_t startPrio)
#define NS_LOG_LOGIC(msg)
void Resize(uint32_t newSize)
virtual Event RemoveNext(void)
Scheduler::Event DoRemoveNext(void)
void DoResize(uint32_t newSize, uint32_t newWidth)
std::list< Scheduler::Event > Bucket
static TypeId GetTypeId(void)
NS_LOG_COMPONENT_DEFINE("PacketLossCounter")
uint32_t Hash(uint64_t key) const
virtual void Insert(const Event &ev)
a unique identifier for an interface.
TypeId SetParent(TypeId tid)