A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
anonymous_namespace{sample-show-progress.cc}::Hold Class Reference

Execute a function periodically, which takes more or less time to run. More...

+ Inheritance diagram for anonymous_namespace{sample-show-progress.cc}::Hold:
+ Collaboration diagram for anonymous_namespace{sample-show-progress.cc}::Hold:

Public Member Functions

 Hold (Ptr< RandomVariableStream > rng)
 Create a hold with a specified random number generator for the wait time.
 
 Hold (Time wait, Time interval)
 Create a Hold with mean inter-event time wait , changing workload every interval .
 
void Event ()
 The Hold event.
 
- Public Member Functions inherited from ns3::SimpleRefCount< Hold >
 SimpleRefCount ()
 Default constructor.
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor.
 
uint32_t GetReferenceCount () const
 Get the reference count of the object.
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator.
 
void Ref () const
 Increment the reference count.
 
void Unref () const
 Decrement the reference count.
 

Private Attributes

Time m_interval
 Time between switching workloads.
 
Ptr< RandomVariableStreamm_rng
 The random number generator for the interval between events.
 
Time m_wait
 Mean inter-event time.
 

Detailed Description

Execute a function periodically, which takes more or less time to run.

Inspired by PHOLD.

Definition at line 42 of file sample-show-progress.cc.

Constructor & Destructor Documentation

◆ Hold() [1/2]

anonymous_namespace{sample-show-progress.cc}::Hold::Hold ( Time wait,
Time interval )
inline

Create a Hold with mean inter-event time wait , changing workload every interval .

Parameters
waitThe mean inter-event time.
intervalHow often to change work load. This should be an order of magnitude larger than wait .

Definition at line 52 of file sample-show-progress.cc.

References ns3::CreateObject().

+ Here is the call graph for this function:

◆ Hold() [2/2]

anonymous_namespace{sample-show-progress.cc}::Hold::Hold ( Ptr< RandomVariableStream > rng)
inline

Create a hold with a specified random number generator for the wait time.

The RNG value will be interpreted as seconds.

Parameters
rngThe random variable generator to use for the inter-event time.

Definition at line 66 of file sample-show-progress.cc.

Member Function Documentation

◆ Event()

void anonymous_namespace{sample-show-progress.cc}::Hold::Event ( )
inline

The Hold event.

Definition at line 72 of file sample-show-progress.cc.

References Event(), ns3::int64x64_t::GetHigh(), ns3::Time::GetNanoSeconds(), ns3::Simulator::Now(), NS_LOG_LOGIC, ns3::Simulator::Schedule(), and ns3::Seconds().

Referenced by Event().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_interval

Time anonymous_namespace{sample-show-progress.cc}::Hold::m_interval
private

Time between switching workloads.

Definition at line 93 of file sample-show-progress.cc.

◆ m_rng

Ptr<RandomVariableStream> anonymous_namespace{sample-show-progress.cc}::Hold::m_rng
private

The random number generator for the interval between events.

Definition at line 89 of file sample-show-progress.cc.

◆ m_wait

Time anonymous_namespace{sample-show-progress.cc}::Hold::m_wait
private

Mean inter-event time.

Definition at line 91 of file sample-show-progress.cc.


The documentation for this class was generated from the following file: