18 #ifndef SYNCHRONIZER_H
19 #define SYNCHRONIZER_H
150 bool Synchronize(uint64_t tsCurrent, uint64_t tsDelay);
A base class which provides memory management and object aggregation.
Base class used for synchronizing the simulation events to some real time "wall clock....
virtual void DoSignal()=0
Tell a possible simulator thread waiting in the DoSynchronize method that an event has happened which...
void Signal()
Tell a possible simulator thread waiting in the Synchronize method that an event has happened which d...
void SetOrigin(uint64_t ts)
Establish a correspondence between a simulation time and the synchronizer real time.
virtual void DoSetCondition(bool cond)=0
Set the condition variable to tell a possible simulator thread waiting in the Synchronize method that...
virtual void DoEventStart()=0
Record the normalized real time at which the current event is starting execution.
uint64_t GetCurrentRealtime()
Retrieve the value of the origin of the underlying normalized wall clock time in simulator timestep u...
virtual uint64_t DoEventEnd()=0
Return the amount of real time elapsed since the last call to EventStart.
bool Realtime()
Return true if this synchronizer is actually synchronizing to a realtime clock.
void EventStart()
Ask the synchronizer to remember what time it is.
virtual bool DoSynchronize(uint64_t nsCurrent, uint64_t nsDelay)=0
Wait until the real time is in sync with the specified simulation time.
uint64_t TimeStepToNanosecond(uint64_t ts)
Convert a simulator time step (in Time resolution units) to a normalized time step in nanosecond unit...
static TypeId GetTypeId()
Get the registered TypeId for this class.
uint64_t GetOrigin()
Retrieve the value of the origin of the simulation time in Time.resolution units.
uint64_t m_realtimeOriginNano
The real time, in ns, when SetOrigin was called.
uint64_t NanosecondToTimeStep(uint64_t ns)
Convert a normalized nanosecond time step into a simulator time step (in Time resolution units).
~Synchronizer() override
Destructor.
virtual int64_t DoGetDrift(uint64_t ns)=0
Get the drift between the real time clock used to synchronize the simulation and the current simulati...
virtual uint64_t DoGetCurrentRealtime()=0
Retrieve the value of the origin of the underlying normalized wall clock time in Time resolution unit...
int64_t GetDrift(uint64_t ts)
Retrieve the difference between the real time clock used to synchronize the simulation and the simula...
virtual bool DoRealtime()=0
Return true if this synchronizer is actually synchronizing to a realtime clock.
uint64_t m_simOriginNano
The simulation time, in ns, when SetOrigin was called.
uint64_t EventEnd()
Ask the synchronizer to return the time step between the instant remembered during EventStart and now...
bool Synchronize(uint64_t tsCurrent, uint64_t tsDelay)
Wait until the real time is in sync with the specified simulation time or until the synchronizer is S...
void SetCondition(bool cond)
Set the condition variable that tells a possible simulator thread waiting in the Synchronize method t...
virtual void DoSetOrigin(uint64_t ns)=0
Establish a correspondence between a simulation time and a wall-clock (real) time.
Synchronizer()
Constructor.
a unique identifier for an interface.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Declaration of classes ns3::Time and ns3::TimeWithUnit, and the TimeValue implementation classes.
ns3::Object class declaration, which is the root of the Object hierarchy and Aggregation.