CppBenchmark  1.0.4.0
C++ Benchmark Library
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. More...
 

Public Member Functions

template<typename... Types>
 BenchmarkPC (const std::string &name, Types... settings)
 Default class constructor. More...
 
 BenchmarkPC (const std::string &name, const TSettings &settings)
 Alternative class constructor. More...
 
 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. More...
 
 BenchmarkBase (const std::string &name, const Settings &settings)
 Alternative class constructor. More...
 
 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. More...
 
const Settingssettings () const
 Get benchmark settings. More...
 
- 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. More...
 
virtual void RunConsumer (ContextPC &context)=0
 Consumer run method. More...
 
- Protected Member Functions inherited from CppBenchmark::BenchmarkBase
void InitBenchmarkContext (Context &context)
 Initialize benchmark context. More...
 
- Protected Member Functions inherited from CppBenchmark::FixturePC
virtual void Initialize (ContextPC &context)
 Initialize benchmark. More...
 
virtual void Cleanup (ContextPC &context)
 Cleanup benchmark. More...
 
virtual void InitializeProducer (ContextPC &context)
 Initialize producer. More...
 
virtual void InitializeConsumer (ContextPC &context)
 Initialize consumer. More...
 
virtual void CleanupProducer (ContextPC &context)
 Cleanup producer. More...
 
virtual void CleanupConsumer (ContextPC &context)
 Cleanup consumer. More...
 

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

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
Examples
mpmc.cpp, mpsc.cpp, and spsc.cpp.

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: