CppBenchmark 1.0.5.0
C++ Benchmark Library
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | List of all members
CppBenchmark::BenchmarkPC Class Referenceabstract

Producers/Consumers benchmark base class. More...

#include <benchmark_pc.h>

Inheritance diagram for CppBenchmark::BenchmarkPC:
CppBenchmark::BenchmarkBase CppBenchmark::FixturePC

Public Types

typedef SettingsPC TSettings
 BenchmarkPC settings type.
 

Public Member Functions

template<typename... Types>
 BenchmarkPC (const std::string &name, Types... settings)
 Default class constructor.
 
 BenchmarkPC (const std::string &name, const TSettings &settings)
 Alternative class constructor.
 
 BenchmarkPC (const BenchmarkPC &)=delete
 
 BenchmarkPC (BenchmarkPC &&)=delete
 
virtual ~BenchmarkPC ()=default
 
BenchmarkPCoperator= (const BenchmarkPC &)=delete
 
BenchmarkPCoperator= (BenchmarkPC &&)=delete
 
- Public Member Functions inherited from CppBenchmark::BenchmarkBase
template<typename... Types>
 BenchmarkBase (const std::string &name, Types... settings)
 Default class constructor.
 
 BenchmarkBase (const std::string &name, const Settings &settings)
 Alternative class constructor.
 
 BenchmarkBase (const BenchmarkBase &)=delete
 
 BenchmarkBase (BenchmarkBase &&)=delete
 
virtual ~BenchmarkBase ()=default
 
BenchmarkBaseoperator= (const BenchmarkBase &)=delete
 
BenchmarkBaseoperator= (BenchmarkBase &&)=delete
 
const std::string & name () const
 Get benchmark name.
 
const Settingssettings () const
 Get benchmark settings.
 
- Public Member Functions inherited from CppBenchmark::FixturePC
 FixturePC () noexcept=default
 
 FixturePC (const FixturePC &) noexcept=default
 
 FixturePC (FixturePC &&) noexcept=default
 
virtual ~FixturePC () noexcept=default
 
FixturePCoperator= (const FixturePC &) noexcept=default
 
FixturePCoperator= (FixturePC &&) noexcept=default
 

Protected Member Functions

virtual void RunProducer (ContextPC &context)=0
 Producer run method.
 
virtual void RunConsumer (ContextPC &context)=0
 Consumer run method.
 
- Protected Member Functions inherited from CppBenchmark::BenchmarkBase
void InitBenchmarkContext (Context &context)
 Initialize benchmark context.
 
- Protected Member Functions inherited from CppBenchmark::FixturePC
virtual void Initialize (ContextPC &context)
 Initialize benchmark.
 
virtual void Cleanup (ContextPC &context)
 Cleanup benchmark.
 
virtual void InitializeProducer (ContextPC &context)
 Initialize producer.
 
virtual void InitializeConsumer (ContextPC &context)
 Initialize consumer.
 
virtual void CleanupProducer (ContextPC &context)
 Cleanup producer.
 
virtual void CleanupConsumer (ContextPC &context)
 Cleanup consumer.
 

Additional Inherited Members

- Static Protected Member Functions inherited from CppBenchmark::BenchmarkBase
static void UpdateBenchmarkMetrics (std::vector< std::shared_ptr< PhaseCore > > &phases)
 Update benchmark metrics for the given benchmark phases collection.
 
static void UpdateBenchmarkMetrics (PhaseCore &phase)
 Update benchmark metrics for the given benchmark phase.
 
static void UpdateBenchmarkThreads (std::vector< std::shared_ptr< PhaseCore > > &phases)
 Update benchmark threads metrics for the given benchmark phases collection.
 
static void UpdateBenchmarkNames (std::vector< std::shared_ptr< PhaseCore > > &phases)
 Update benchmark names for the given benchmark phases collection.
 
static void UpdateBenchmarkNames (PhaseCore &phase, const std::string &name)
 Update benchmark names for the given benchmark phase.
 
static void UpdateBenchmarkOperations (std::vector< std::shared_ptr< PhaseCore > > &phases)
 Update benchmark operations for the given benchmark phases collection.
 
static void UpdateBenchmarkOperations (PhaseCore &phase)
 Update benchmark operations for the given benchmark phase.
 
- Protected Attributes inherited from CppBenchmark::BenchmarkBase
bool _launched
 Benchmark launched flag.
 
std::string _name
 Benchmark name.
 
Settings _settings
 Benchmark settings.
 
std::vector< std::shared_ptr< PhaseCore > > _phases
 Benchmark phases.
 

Detailed Description

Producers/Consumers benchmark base class.

Provides interface to perform benchmark of the producers/consumers pattern in multi-thread environment.

Examples
mpmc.cpp, mpsc.cpp, and spsc.cpp.

Definition at line 25 of file benchmark_pc.h.

Member Typedef Documentation

◆ TSettings

BenchmarkPC settings type.

Definition at line 29 of file benchmark_pc.h.

Constructor & Destructor Documentation

◆ BenchmarkPC() [1/4]

template<typename... Types>
CppBenchmark::BenchmarkPC::BenchmarkPC ( const std::string &  name,
Types...  settings 
)
inlineexplicit

Default class constructor.

Parameters
name- Benchmark name
settings- Benchmark settings

Definition at line 37 of file benchmark_pc.h.

◆ BenchmarkPC() [2/4]

CppBenchmark::BenchmarkPC::BenchmarkPC ( const std::string &  name,
const TSettings settings 
)
inlineexplicit

Alternative class constructor.

Parameters
name- Benchmark name
settings- Benchmark settings

Definition at line 43 of file benchmark_pc.h.

◆ BenchmarkPC() [3/4]

CppBenchmark::BenchmarkPC::BenchmarkPC ( const BenchmarkPC )
delete

◆ BenchmarkPC() [4/4]

CppBenchmark::BenchmarkPC::BenchmarkPC ( BenchmarkPC &&  )
delete

◆ ~BenchmarkPC()

virtual CppBenchmark::BenchmarkPC::~BenchmarkPC ( )
virtualdefault

Member Function Documentation

◆ operator=() [1/2]

BenchmarkPC & CppBenchmark::BenchmarkPC::operator= ( BenchmarkPC &&  )
delete

◆ operator=() [2/2]

BenchmarkPC & CppBenchmark::BenchmarkPC::operator= ( const BenchmarkPC )
delete

◆ RunConsumer()

virtual void CppBenchmark::BenchmarkPC::RunConsumer ( ContextPC context)
protectedpure virtual

Consumer run method.

Should be implemented to provide code which consumes items. This code will be executed for each consumer in separate thread!

Parameters
context- Consumers running context
Examples
mpmc.cpp, mpsc.cpp, and spsc.cpp.

◆ RunProducer()

virtual void CppBenchmark::BenchmarkPC::RunProducer ( ContextPC context)
protectedpure virtual

Producer run method.

Should be implemented to provide code which produces items. This code will be executed for each producer in separate thread!

Parameters
context- Producer running context
Examples
mpmc.cpp, mpsc.cpp, and spsc.cpp.

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