A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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.
 
Result Run ()
 Run the benchmark as configured.
 
void SetPopulation (const uint64_t population)
 Set the number of events to populate the scheduler with.
 
void SetRandomStream (Ptr< RandomVariableStream > stream)
 Set the event delay interval random stream.
 
void SetTotal (const uint64_t total)
 Set the total number of events to execute.
 

Private Member Functions

void Cb ()
 Event function.
 

Private Attributes

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

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 47 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 55 of file bench-scheduler.cc.

Member Function Documentation

◆ Cb()

void Bench::Cb ( )
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(), ns3::Simulator::Now(), ns3::Simulator::Schedule(), and ns3::Simulator::Stop().

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 ( )

Run the benchmark as configured.

Returns
The Result.

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

References Cb(), DEB, ns3::Simulator::Destroy(), ns3::SystemWallClockMs::End(), ns3::RandomVariableStream::GetValue(), m_count, m_population, m_rand, ns3::NanoSeconds(), ns3::Simulator::Run(), ns3::Simulator::Schedule(), 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 78 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 68 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 87 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 118 of file bench-scheduler.cc.

Referenced by Cb(), and Run().

◆ m_population

uint64_t Bench::m_population
private

Event population size.

Definition at line 116 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 115 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 117 of file bench-scheduler.cc.

Referenced by Cb(), and SetTotal().


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