A Discrete-Event Network Simulator
API
Bench Class Reference

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

+ Collaboration diagram for Bench:

Classes

struct  Result
 The output. More...
 

Public Member Functions

 Bench (const uint64_t population, const uint64_t total)
 Constructor. More...
 
Result Run (void)
 Run the benchmark as configured. More...
 
void SetPopulation (const uint64_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 uint64_t total)
 Set the total number of events to execute. More...
 

Private Member Functions

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

Private Attributes

uint64_t m_count
 Count of events executed so far. More...
 
uint64_t m_population
 Event population size. More...
 
Ptr< RandomVariableStreamm_rand
 Stream for event delays. More...
 
uint64_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 55 of file bench-scheduler.cc.

Constructor & Destructor Documentation

◆ Bench()

Bench::Bench ( const uint64_t  population,
const uint64_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 63 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 160 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 Run().

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

◆ Run()

Bench::Result Bench::Run ( void  )

Run the benchmark as configured.

Returns
The Result.

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

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

Referenced by BenchSuite::BenchSuite().

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

◆ SetPopulation()

void Bench::SetPopulation ( const uint64_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 86 of file bench-scheduler.cc.

References m_population.

Referenced by BenchSuite::BenchSuite().

+ 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 76 of file bench-scheduler.cc.

References m_rand.

Referenced by BenchSuite::BenchSuite().

+ Here is the caller graph for this function:

◆ SetTotal()

void Bench::SetTotal ( const uint64_t  total)
inline

Set the total number of events to execute.

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

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

References m_total.

Referenced by BenchSuite::BenchSuite().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_count

uint64_t Bench::m_count
private

Count of events executed so far.

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

Referenced by Cb(), and Run().

◆ m_population

uint64_t Bench::m_population
private

Event population size.

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

Referenced by Run(), and SetPopulation().

◆ m_rand

Ptr<RandomVariableStream> Bench::m_rand
private

Stream for event delays.

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

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

◆ m_total

uint64_t Bench::m_total
private

Total number of events to execute.

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

Referenced by Cb(), and SetTotal().


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