51 static TypeId tid =
TypeId (
"ns3::RealtimeSimulatorImpl")
53 .AddConstructor<RealtimeSimulatorImpl> ()
54 .AddAttribute (
"SynchronizationMode",
55 "What to do if the simulation cannot keep up with real time.",
60 .AddAttribute (
"HardLimit",
61 "Maximum acceptable real-time jitter (used in conjunction with SynchronizationMode=HardLimit)",
131 if (ev->IsCancelled () ==
false)
150 while (
m_events->IsEmpty () ==
false)
153 scheduler->Insert (next);
185 uint64_t tsDelay = 0;
215 "RealtimeSimulatorImpl::ProcessOneEvent (): Synchronizer reports not Realtime ()");
242 tsDelay = tsNext - tsNow;
323 "RealtimeSimulatorImpl::ProcessOneEvent(): event queue is empty");
333 "RealtimeSimulatorImpl::ProcessOneEvent(): "
334 "next.GetTs() earlier than m_currentTs (list order error)");
372 "Hard real-time limit exceeded (jitter = " << tsJitter <<
")");
408 "RealtimeSimulatorImpl::NextTs(): event queue is empty");
419 "RealtimeSimulatorImpl::Run(): Simulator already running");
430 uint64_t tsDelay = 1000000000;
434 bool process =
false;
469 "RealtimeSimulatorImpl::Run(): Empty queue and unprocessed events");
641 "RealtimeSimulatorImpl::ScheduleRealtimeNowWithContext(): schedule for time < m_currentTs");
707 if (
id.GetUid () == 2)
731 event.
impl =
id.PeekEventImpl ();
732 event.key.m_ts =
id.GetTs ();
733 event.key.m_context =
id.GetContext ();
734 event.key.m_uid =
id.GetUid ();
738 event.impl->Cancel ();
739 event.impl->Unref ();
748 id.PeekEventImpl ()->Cancel ();
800 return TimeStep (0x7fffffffffffffffLL);
void ProcessOneEvent(void)
void ScheduleRealtimeNowWithContext(uint32_t context, EventImpl *event)
void SetSynchronizationMode(RealtimeSimulatorImpl::SynchronizationMode mode)
keep track of time values and allow control of global simulation resolution
Ptr< Synchronizer > m_synchronizer
smart pointer class similar to boost::intrusive_ptr
bool IsPositive(void) const
#define NS_LOG_FUNCTION(parameters)
Ptr< const AttributeChecker > MakeEnumChecker(int v1, std::string n1, int v2, std::string n2, int v3, std::string n3, int v4, std::string n4, int v5, std::string n5, int v6, std::string n6, int v7, std::string n7, int v8, std::string n8, int v9, std::string n9, int v10, std::string n10, int v11, std::string n11, int v12, std::string n12, int v13, std::string n13, int v14, std::string n14, int v15, std::string n15, int v16, std::string n16, int v17, std::string n17, int v18, std::string n18, int v19, std::string n19, int v20, std::string n20, int v21, std::string n21, int v22, std::string n22)
uint64_t NextTs(void) const
virtual EventId ScheduleNow(EventImpl *event)
virtual EventId Schedule(Time const &time, EventImpl *event)
Time TimeStep(uint64_t ts)
SystemThread::ThreadId m_main
void ScheduleRealtimeNow(EventImpl *event)
#define NS_LOG_COMPONENT_DEFINE(name)
Time RealtimeNow(void) const
virtual Time GetMaximumSimulationTime(void) const
virtual void DoDispose(void)
Time GetHardLimit(void) const
SynchronizationMode m_synchronizationMode
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
EventImpl * PeekEventImpl(void) const
void ScheduleRealtimeWithContext(uint32_t context, Time const &time, EventImpl *event)
DestroyEvents m_destroyEvents
virtual void DoDispose(void)
virtual EventId ScheduleDestroy(EventImpl *event)
virtual void ScheduleWithContext(uint32_t context, Time const &time, EventImpl *event)
#define NS_FATAL_ERROR(msg)
fatal error handling
Ptr< Scheduler > m_events
RealtimeSimulatorImpl::SynchronizationMode GetSynchronizationMode(void) const
static TypeId GetTypeId(void)
hold variables of type 'enum'
hold objects of type ns3::Time
virtual Time Now(void) const
Ptr< Object > Create(void) const
A class which provides a simple way to implement a Critical Section.
NS_OBJECT_ENSURE_REGISTERED(AntennaModel)
virtual void Remove(const EventId &ev)
uint32_t GetUid(void) const
#define NS_LOG_LOGIC(msg)
virtual void Cancel(const EventId &ev)
static bool Equals(ThreadId id)
Compares an TharedId with the current ThreadId .
virtual Time GetDelayLeft(const EventId &id) const
virtual uint32_t GetSystemId(void) const
void SetHardLimit(Time limit)
int64_t GetTimeStep(void) const
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
virtual bool IsExpired(const EventId &ev) const
#define NS_ASSERT_MSG(condition, message)
virtual void SetScheduler(ObjectFactory schedulerFactory)
instantiate subclasses of ns3::Object.
an identifier for simulation events.
bool Realtime(void) const
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range. Both limits are inclusive.
virtual uint32_t GetContext(void) const
void ScheduleRealtime(Time const &time, EventImpl *event)
static ThreadId Self(void)
Returns the current thread Id.
virtual bool IsFinished(void) const
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
uint32_t m_currentContext
uint64_t GetTs(void) const