uint64_t m_ts;// Event time stamp.
DefaultSimulatorImpl::ventWithContext
uint64_t timestamp;
m_currentTs = 0;
m_currentTs = next.key.m_ts;
Scheduler::Event ev;
ev.key.m_ts = m_currentTs + event.timestamp;//详见ScheduleWithContext函数的解释
DefaultSimulatorImpl::Stop (Time const &time)
{
NS_LOG_FUNCTION (this << time.GetTimeStep ());
Simulator::Schedule (time, &Simulator::Stop);
}
EventId DefaultSimulatorImpl::Schedule (Time const &time, EventImpl *event)
{
Time tAbsolute = time + TimeStep (m_currentTs);
Scheduler::Event ev;
ev.key.m_ts = (uint64_t) tAbsolute.GetTimeStep ();
}ScheduleWithContext
void DefaultSimulatorImpl::ScheduleWithContext (uint32_t context, Time const &time, EventImpl *event)
{
if (SystemThread::Equals (m_main)){
Time tAbsolute = time + TimeStep (m_currentTs);
Scheduler::Event ev;
ev.key.m_ts = (uint64_t) tAbsolute.GetTimeStep ();
}
else{
EventWithContext ev;
ev.timestamp = time.GetTimeStep ();
创建临界区并把ev插入m_eventsWithContext中
}
}
EventId DefaultSimulatorImpl::ScheduleNow (EventImpl *event)
{
ev.key.m_ts = m_currentTs;
}