CppBenchmark  1.0.4.0
C++ Benchmark Library
Public Member Functions | Protected Attributes | List of all members
CppBenchmark::Launcher Class Reference

Launcher base class. More...

#include <launcher.h>

Inheritance diagram for CppBenchmark::Launcher:
CppBenchmark::LauncherHandler CppBenchmark::LauncherConsole

Public Member Functions

 Launcher ()=default
 
 Launcher (const Launcher &)=delete
 
 Launcher (Launcher &&)=delete
 
virtual ~Launcher ()=default
 
Launcheroperator= (const Launcher &)=delete
 
Launcheroperator= (Launcher &&)=delete
 
void AddBenchmark (const std::shared_ptr< BenchmarkBase > &benchmark)
 Add the given benchmark to the benchmarks collection. More...
 
void ClearAllBenchmarks ()
 Clear benchmarks collection. More...
 
void AddBenchmarkBuilder (const std::function< std::shared_ptr< BenchmarkBase >()> &builder)
 Add the given benchmark builder function to the benchmark builders collection. More...
 
void ClearAllBenchmarksBuilders ()
 Clear benchmark builders collection. More...
 
virtual void Launch (const std::string &pattern="")
 Launch registered benchmarks. More...
 
void Report (Reporter &reporter) const
 Report benchmarks results using the given reporter. More...
 
void ReportHistograms (int32_t resolution) const
 Report benchmarks High Dynamic Range (HDR) Histograms. More...
 
- Public Member Functions inherited from CppBenchmark::LauncherHandler
 LauncherHandler ()=default
 
 LauncherHandler (const LauncherHandler &)=default
 
 LauncherHandler (LauncherHandler &&) noexcept=default
 
virtual ~LauncherHandler ()=default
 
LauncherHandleroperator= (const LauncherHandler &)=default
 
LauncherHandleroperator= (LauncherHandler &&) noexcept=default
 

Protected Attributes

std::vector< std::shared_ptr< BenchmarkBase > > _benchmarks
 Registered benchmarks collection. More...
 
std::vector< std::function< std::shared_ptr< BenchmarkBase >)> > _builders
 Benchmark builders collection. More...
 

Additional Inherited Members

- Protected Member Functions inherited from CppBenchmark::LauncherHandler
virtual void onLaunching (int current, int total, const BenchmarkBase &benchmark, const Context &context, int attempt)
 Handle benchmark launching notification. More...
 
virtual void onLaunched (int current, int total, const BenchmarkBase &benchmark, const Context &context, int attempt)
 Handle benchmark launched notification. More...
 

Detailed Description

Launcher base class.

Provides interface to register benchmarks, launch them and report results with external reporters.

Definition at line 24 of file launcher.h.

Constructor & Destructor Documentation

◆ Launcher() [1/3]

CppBenchmark::Launcher::Launcher ( )
default

◆ Launcher() [2/3]

CppBenchmark::Launcher::Launcher ( const Launcher )
delete

◆ Launcher() [3/3]

CppBenchmark::Launcher::Launcher ( Launcher &&  )
delete

◆ ~Launcher()

virtual CppBenchmark::Launcher::~Launcher ( )
virtualdefault

Member Function Documentation

◆ AddBenchmark()

void CppBenchmark::Launcher::AddBenchmark ( const std::shared_ptr< BenchmarkBase > &  benchmark)
inline

Add the given benchmark to the benchmarks collection.

Parameters
benchmark- Benchmark to register

Definition at line 39 of file launcher.h.

◆ AddBenchmarkBuilder()

void CppBenchmark::Launcher::AddBenchmarkBuilder ( const std::function< std::shared_ptr< BenchmarkBase >()> &  builder)
inline

Add the given benchmark builder function to the benchmark builders collection.

Parameters
builder- Benchmark builder function

Definition at line 47 of file launcher.h.

◆ ClearAllBenchmarks()

void CppBenchmark::Launcher::ClearAllBenchmarks ( )
inline

Clear benchmarks collection.

Definition at line 41 of file launcher.h.

◆ ClearAllBenchmarksBuilders()

void CppBenchmark::Launcher::ClearAllBenchmarksBuilders ( )
inline

Clear benchmark builders collection.

Definition at line 49 of file launcher.h.

◆ Launch()

void CppBenchmark::Launcher::Launch ( const std::string &  pattern = "")
virtual

Launch registered benchmarks.

Launch benchmarks from the benchmarks collection which names are matched to the given string pattern. String pattern is represented with a regular expression.

Parameters
pattern- Pattern to match with benchmark names

Definition at line 16 of file launcher.cpp.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ Report()

void CppBenchmark::Launcher::Report ( Reporter reporter) const

Report benchmarks results using the given reporter.

Parameters
reporter- Reporter interface

Definition at line 43 of file launcher.cpp.

◆ ReportHistograms()

void CppBenchmark::Launcher::ReportHistograms ( int32_t  resolution) const

Report benchmarks High Dynamic Range (HDR) Histograms.

Parameters
resolution- Histogram resolution

Definition at line 85 of file launcher.cpp.

Member Data Documentation

◆ _benchmarks

std::vector<std::shared_ptr<BenchmarkBase> > CppBenchmark::Launcher::_benchmarks
protected

Registered benchmarks collection.

Definition at line 73 of file launcher.h.

◆ _builders

std::vector<std::function<std::shared_ptr<BenchmarkBase>)> > CppBenchmark::Launcher::_builders
protected

Benchmark builders collection.

Definition at line 75 of file launcher.h.


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