42 .AddConstructor<CalendarScheduler> ()
78 std::cout <<
"Bucket Distribution ";
83 std::cout << std::endl;
103 Bucket::iterator end =
m_buckets[bucket].end ();
104 for (Bucket::iterator i =
m_buckets[bucket].begin (); i != end; ++i)
150 if (next.
key < minEvent.
key)
171 int32_t minBucket = -1;
174 minKey.
m_ts = uint64_t(-int64_t(1));
190 if (next.
key < minKey)
234 Bucket::iterator end =
m_buckets[bucket].end ();
235 for (Bucket::iterator i =
m_buckets[bucket].begin (); i != end; ++i)
296 std::list<Scheduler::Event> samples;
303 for (uint32_t i = 0; i < nSamples; i++)
308 for (std::list<Scheduler::Event>::const_iterator i = samples.begin ();
309 i != samples.end (); ++i)
320 uint64_t totalSeparation = 0;
321 std::list<Scheduler::Event>::const_iterator end = samples.end ();
322 std::list<Scheduler::Event>::const_iterator cur = samples.begin ();
323 std::list<Scheduler::Event>::const_iterator next = cur;
327 totalSeparation += next->key.m_ts - cur->key.m_ts;
331 uint64_t twiceAvg = totalSeparation / (nSamples - 1) * 2;
333 cur = samples.begin ();
338 uint64_t diff = next->key.m_ts - cur->key.m_ts;
339 if (diff <= twiceAvg)
341 totalSeparation += diff;
347 totalSeparation *= 3;
348 totalSeparation = std::max (totalSeparation, (uint64_t)1);
349 return totalSeparation;
360 for (uint32_t i = 0; i < oldNBuckets; i++)
362 Bucket::iterator end = oldBuckets[i].end ();
363 for (Bucket::iterator j = oldBuckets[i].begin (); j != end; ++j)
368 delete [] oldBuckets;
#define NS_LOG_FUNCTION(parameters)
NS_LOG_COMPONENT_DEFINE("GrantedTimeWindowMpiInterface")
uint32_t CalculateNewWidth(void)
void DoInsert(const Event &ev)
#define NS_ASSERT(condition)
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
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)
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)
This method cannot be invoked if the list is empty.
Scheduler::Event DoRemoveNext(void)
void DoResize(uint32_t newSize, uint32_t newWidth)
std::list< Scheduler::Event > Bucket
static TypeId GetTypeId(void)
uint32_t Hash(uint64_t key) const
virtual void Insert(const Event &ev)
a unique identifier for an interface.
TypeId SetParent(TypeId tid)