A Discrete-Event Network Simulator
API
Bench Class Reference

Benchmark instance which can do a single run. More...

+ Collaboration diagram for Bench:

Public Member Functions

 Bench (const uint32_t population, const uint32_t total)
 Constructor. More...
 
void RunBench (void)
 Run the benchmark as configure. More...
 
void SetPopulation (const uint32_t population)
 Set the number of events to populate the scheduler with. More...
 
void SetRandomStream (Ptr< RandomVariableStream > stream)
 Set the event delay interval random stream. More...
 
void SetTotal (const uint32_t total)
 Set the total number of events to execute. More...
 

Private Member Functions

void Cb (void)
 Event function. More...
 

Private Attributes

uint32_t m_count
 Count of events executed so far. More...
 
uint32_t m_population
 Event population size. More...
 
Ptr< RandomVariableStreamm_rand
 Stream for event delays. More...
 
uint32_t m_total
 Total number of events to execute. More...
 

Detailed Description

Benchmark instance which can do a single run.

The run is controlled by the event population size and total number of events, which are set at construction.

The event distribution in time is set by SetRandomStream()

Definition at line 54 of file bench-scheduler.cc.

Constructor & Destructor Documentation

◆ Bench()

Bench::Bench ( const uint32_t  population,
const uint32_t  total 
)
inline

Constructor.

Parameters
[in]populationThe number of events to keep in the scheduler.
[in]totalThe total number of events to execute.

Definition at line 62 of file bench-scheduler.cc.

Member Function Documentation

◆ Cb()

void Bench::Cb ( void  )
private

Event function.

This checks for completion (total number of events executed) and schedules a new event if not complete.

Definition at line 153 of file bench-scheduler.cc.

References Cb(), DEB, ns3::RandomVariableStream::GetValue(), m_count, m_rand, m_total, ns3::NanoSeconds(), and ns3::Now().

Referenced by Cb(), and RunBench().

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

◆ RunBench()

void Bench::RunBench ( void  )

Run the benchmark as configure.

Definition at line 116 of file bench-scheduler.cc.

References Cb(), DEB, ns3::SystemWallClockMs::End(), g_fwidth, ns3::RandomVariableStream::GetValue(), LOG, m_count, m_population, m_rand, ns3::NanoSeconds(), Run(), and ns3::SystemWallClockMs::Start().

Referenced by Run().

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

◆ SetPopulation()

void Bench::SetPopulation ( const uint32_t  population)
inline

Set the number of events to populate the scheduler with.

Each event executed schedules a new event, maintaining the population.

Parameters
[in]populationThe number of events to keep in the scheduler.

Definition at line 85 of file bench-scheduler.cc.

References m_population.

Referenced by Run().

+ Here is the caller graph for this function:

◆ SetRandomStream()

void Bench::SetRandomStream ( Ptr< RandomVariableStream stream)
inline

Set the event delay interval random stream.

Parameters
[in]streamThe random variable stream to be used to generate delays for future events.

Definition at line 75 of file bench-scheduler.cc.

References m_rand.

Referenced by Run().

+ Here is the caller graph for this function:

◆ SetTotal()

void Bench::SetTotal ( const uint32_t  total)
inline

Set the total number of events to execute.

Parameters
[in]totalThe total number of events to execute.

Definition at line 94 of file bench-scheduler.cc.

References m_total.

Referenced by Run().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_count

uint32_t Bench::m_count
private

Count of events executed so far.

Definition at line 112 of file bench-scheduler.cc.

Referenced by Cb(), and RunBench().

◆ m_population

uint32_t Bench::m_population
private

Event population size.

Definition at line 110 of file bench-scheduler.cc.

Referenced by RunBench(), and SetPopulation().

◆ m_rand

Ptr<RandomVariableStream> Bench::m_rand
private

Stream for event delays.

Definition at line 109 of file bench-scheduler.cc.

Referenced by Cb(), RunBench(), and SetRandomStream().

◆ m_total

uint32_t Bench::m_total
private

Total number of events to execute.

Definition at line 111 of file bench-scheduler.cc.

Referenced by Cb(), and SetTotal().


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