CppBenchmark  1.0.4.0
C++ Benchmark Library
Public Types | Public Member Functions | Protected Member Functions | List of all members
CppBenchmark::Benchmark Class Referenceabstract

Benchmark class. More...

#include <benchmark.h>

Inheritance diagram for CppBenchmark::Benchmark:
CppBenchmark::BenchmarkBase CppBenchmark::Fixture

Public Types

typedef Settings TSettings
 Benchmark settings type. More...
 

Public Member Functions

template<typename... Types>
 Benchmark (const std::string &name, Types... settings)
 Default class constructor. More...
 
 Benchmark (const std::string &name, const TSettings &settings)
 Alternative class constructor. More...
 
 Benchmark (const Benchmark &)=delete
 
 Benchmark (Benchmark &&)=delete
 
virtual ~Benchmark ()=default
 
Benchmarkoperator= (const Benchmark &)=delete
 
Benchmarkoperator= (Benchmark &&)=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::Fixture
 Fixture () noexcept=default
 
 Fixture (const Fixture &) noexcept=default
 
 Fixture (Fixture &&) noexcept=default
 
virtual ~Fixture () noexcept=default
 
Fixtureoperator= (const Fixture &) noexcept=default
 
Fixtureoperator= (Fixture &&) noexcept=default
 

Protected Member Functions

virtual void Run (Context &context)=0
 Benchmark run method. More...
 
- Protected Member Functions inherited from CppBenchmark::BenchmarkBase
void InitBenchmarkContext (Context &context)
 Initialize benchmark context. More...
 
- Protected Member Functions inherited from CppBenchmark::Fixture
virtual void Initialize (Context &context)
 Initialize benchmark. More...
 
virtual void Cleanup (Context &context)
 Cleanup benchmark. 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

Benchmark class.

Provides interface to perform single thread benchmark.

Examples
sort.cpp.

Definition at line 21 of file benchmark.h.

Member Typedef Documentation

◆ TSettings

Benchmark settings type.

Definition at line 25 of file benchmark.h.

Constructor & Destructor Documentation

◆ Benchmark() [1/4]

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

Default class constructor.

Parameters
name- Benchmark name
settings- Benchmark settings
Examples
sort.cpp.

Definition at line 33 of file benchmark.h.

◆ Benchmark() [2/4]

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

Alternative class constructor.

Parameters
name- Benchmark name
settings- Benchmark settings

Definition at line 39 of file benchmark.h.

◆ Benchmark() [3/4]

CppBenchmark::Benchmark::Benchmark ( const Benchmark )
delete

◆ Benchmark() [4/4]

CppBenchmark::Benchmark::Benchmark ( Benchmark &&  )
delete

◆ ~Benchmark()

virtual CppBenchmark::Benchmark::~Benchmark ( )
virtualdefault

Member Function Documentation

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ Run()

virtual void CppBenchmark::Benchmark::Run ( Context context)
protectedpure virtual

Benchmark run method.

Should be implemented to provide code fragment to measure.

Parameters
context- Benchmark running context
Examples
sort.cpp.

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