CppBenchmark 1.0.6.0
C++ Benchmark Library
Loading...
Searching...
No Matches
CppBenchmark::BenchmarkBase Class Reference

Benchmark base class. More...

#include <benchmark_base.h>

Inheritance diagram for CppBenchmark::BenchmarkBase:
CppBenchmark::Benchmark CppBenchmark::BenchmarkPC CppBenchmark::BenchmarkThreads

Public Member Functions

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
BenchmarkBase & operator= (const BenchmarkBase &)=delete
BenchmarkBase & operator= (BenchmarkBase &&)=delete
const std::string & name () const
 Get benchmark name.
const Settings & settings () const
 Get benchmark settings.

Protected Member Functions

virtual int CountLaunches () const
 Get the count of benchmark launches.
virtual void Launch (int &current, int total, LauncherHandler &handler)
 Get the count of benchmark launches.
void InitBenchmarkContext (Context &context)
 Initialize benchmark context.

Static Protected Member Functions

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

bool _launched
 Benchmark launched flag.
std::string _name
 Benchmark name.
Settings _settings
 Benchmark settings.
std::vector< std::shared_ptr< PhaseCore > > _phases
 Benchmark phases.

Friends

class Executor
class Launcher

Detailed Description

Benchmark base class.

Provides base interface for all benchmarks.

Definition at line 24 of file benchmark_base.h.

Constructor & Destructor Documentation

◆ BenchmarkBase() [1/4]

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

Default class constructor.

Parameters
name- Benchmark name
settings- Benchmark settings

Definition at line 36 of file benchmark_base.h.

◆ BenchmarkBase() [2/4]

CppBenchmark::BenchmarkBase::BenchmarkBase ( const std::string & name,
const Settings & settings )
inlineexplicit

Alternative class constructor.

Parameters
name- Benchmark name
settings- Benchmark settings

Definition at line 44 of file benchmark_base.h.

◆ BenchmarkBase() [3/4]

CppBenchmark::BenchmarkBase::BenchmarkBase ( const BenchmarkBase & )
delete

◆ BenchmarkBase() [4/4]

CppBenchmark::BenchmarkBase::BenchmarkBase ( BenchmarkBase && )
delete

◆ ~BenchmarkBase()

virtual CppBenchmark::BenchmarkBase::~BenchmarkBase ( )
virtualdefault

Member Function Documentation

◆ CountLaunches()

virtual int CppBenchmark::BenchmarkBase::CountLaunches ( ) const
inlineprotectedvirtual

Get the count of benchmark launches.

Returns
Benchmark launches count

Definition at line 73 of file benchmark_base.h.

◆ InitBenchmarkContext()

void CppBenchmark::BenchmarkBase::InitBenchmarkContext ( Context & context)
protected

Initialize benchmark context.

Parameters
context- Benchmark context

Definition at line 15 of file benchmark_base.cpp.

◆ Launch()

virtual void CppBenchmark::BenchmarkBase::Launch ( int & current,
int total,
LauncherHandler & handler )
inlineprotectedvirtual

Get the count of benchmark launches.

Parameters
current- Current benchmark number
total- Total benchmarks
handler- Launcher handler

Definition at line 81 of file benchmark_base.h.

◆ name()

const std::string & CppBenchmark::BenchmarkBase::name ( ) const
inline

Get benchmark name.

Definition at line 55 of file benchmark_base.h.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ settings()

const Settings & CppBenchmark::BenchmarkBase::settings ( ) const
inline

Get benchmark settings.

Definition at line 57 of file benchmark_base.h.

◆ UpdateBenchmarkMetrics() [1/2]

void CppBenchmark::BenchmarkBase::UpdateBenchmarkMetrics ( PhaseCore & phase)
staticprotected

Update benchmark metrics for the given benchmark phase.

Parameters
phase- Benchmark phase

Definition at line 41 of file benchmark_base.cpp.

◆ UpdateBenchmarkMetrics() [2/2]

void CppBenchmark::BenchmarkBase::UpdateBenchmarkMetrics ( std::vector< std::shared_ptr< PhaseCore > > & phases)
staticprotected

Update benchmark metrics for the given benchmark phases collection.

Parameters
phases- Benchmark phases collection

Definition at line 35 of file benchmark_base.cpp.

◆ UpdateBenchmarkNames() [1/2]

void CppBenchmark::BenchmarkBase::UpdateBenchmarkNames ( PhaseCore & phase,
const std::string & name )
staticprotected

Update benchmark names for the given benchmark phase.

Parameters
phase- Benchmark phase
name- Benchmark name

Definition at line 84 of file benchmark_base.cpp.

◆ UpdateBenchmarkNames() [2/2]

void CppBenchmark::BenchmarkBase::UpdateBenchmarkNames ( std::vector< std::shared_ptr< PhaseCore > > & phases)
staticprotected

Update benchmark names for the given benchmark phases collection.

Parameters
phases- Benchmark phases collection

Definition at line 78 of file benchmark_base.cpp.

◆ UpdateBenchmarkOperations() [1/2]

void CppBenchmark::BenchmarkBase::UpdateBenchmarkOperations ( PhaseCore & phase)
staticprotected

Update benchmark operations for the given benchmark phase.

Parameters
phase- Benchmark phase

Definition at line 97 of file benchmark_base.cpp.

◆ UpdateBenchmarkOperations() [2/2]

void CppBenchmark::BenchmarkBase::UpdateBenchmarkOperations ( std::vector< std::shared_ptr< PhaseCore > > & phases)
staticprotected

Update benchmark operations for the given benchmark phases collection.

Parameters
phases- Benchmark phases collection

Definition at line 91 of file benchmark_base.cpp.

◆ UpdateBenchmarkThreads()

void CppBenchmark::BenchmarkBase::UpdateBenchmarkThreads ( std::vector< std::shared_ptr< PhaseCore > > & phases)
staticprotected

Update benchmark threads metrics for the given benchmark phases collection.

Parameters
phases- Benchmark phases collection

Definition at line 49 of file benchmark_base.cpp.

◆ Executor

friend class Executor
friend

Definition at line 26 of file benchmark_base.h.

◆ Launcher

friend class Launcher
friend

Definition at line 27 of file benchmark_base.h.

Member Data Documentation

◆ _launched

bool CppBenchmark::BenchmarkBase::_launched
protected

Benchmark launched flag.

Definition at line 61 of file benchmark_base.h.

◆ _name

std::string CppBenchmark::BenchmarkBase::_name
protected

Benchmark name.

Definition at line 63 of file benchmark_base.h.

◆ _phases

std::vector<std::shared_ptr<PhaseCore> > CppBenchmark::BenchmarkBase::_phases
protected

Benchmark phases.

Definition at line 67 of file benchmark_base.h.

◆ _settings

Settings CppBenchmark::BenchmarkBase::_settings
protected

Benchmark settings.

Definition at line 65 of file benchmark_base.h.


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