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

Dynamic benchmarks executor class. More...

#include <executor.h>

Public Member Functions

 Executor (const Executor &)=delete
 
 Executor (Executor &&)=delete
 
 ~Executor ()=default
 
Executoroperator= (const Executor &)=delete
 
Executoroperator= (Executor &&)=delete
 

Static Public Member Functions

static std::shared_ptr< PhaseStartBenchmark (const std::string &benchmark)
 Start a new dynamic benchmark with a given name. More...
 
static void StopBenchmark (const std::string &benchmark)
 Stop dynamic benchmark with a given name. More...
 
static std::shared_ptr< PhaseScopeScopeBenchmark (const std::string &benchmark)
 Start a new dynamic benchmark with a given name and wrap it in a PhaseScope. More...
 
static void Report (Reporter &reporter)
 Report benchmarks results using the given reporter. More...
 

Protected Attributes

std::mutex _mutex
 Synchronization mutex. More...
 
std::vector< std::shared_ptr< PhaseCore > > _benchmarks
 Registered benchmarks collection. More...
 

Detailed Description

Dynamic benchmarks executor class.

Provides interface to register dynamic benchmarks and report results with external reporters.

Definition at line 21 of file executor.h.

Constructor & Destructor Documentation

◆ Executor() [1/2]

CppBenchmark::Executor::Executor ( const Executor )
delete

◆ Executor() [2/2]

CppBenchmark::Executor::Executor ( Executor &&  )
delete

◆ ~Executor()

CppBenchmark::Executor::~Executor ( )
default

Member Function Documentation

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ Report()

void CppBenchmark::Executor::Report ( Reporter reporter)
static

Report benchmarks results using the given reporter.

Please note the method is thread-safe and might be called in multi-thread environment!

Parameters
reporter- Reporter interface

Definition at line 98 of file executor.cpp.

◆ ScopeBenchmark()

static std::shared_ptr<PhaseScope> CppBenchmark::Executor::ScopeBenchmark ( const std::string &  benchmark)
inlinestatic

Start a new dynamic benchmark with a given name and wrap it in a PhaseScope.

Please note the method is thread-safe and might be called in multi-thread environment!

Parameters
benchmark- Dynamic benchmark name
Returns
Shared pointer to the required dynamic benchmark scope wrapper

Definition at line 58 of file executor.h.

◆ StartBenchmark()

std::shared_ptr< Phase > CppBenchmark::Executor::StartBenchmark ( const std::string &  benchmark)
static

Start a new dynamic benchmark with a given name.

This method will create or get existent dynamic benchmark with a given name, start benchmark measurement and return it as a shared pointer. Please note the method is thread-safe and might be called in multi-thread environment!

Parameters
benchmark- Dynamic benchmark name
Returns
Shared pointer to the required dynamic benchmark

Definition at line 47 of file executor.cpp.

◆ StopBenchmark()

void CppBenchmark::Executor::StopBenchmark ( const std::string &  benchmark)
static

Stop dynamic benchmark with a given name.

This method will try to find existent dynamic benchmark with a given name and stop benchmark measurement for it. Please note the method is thread-safe and might be called in multi-thread environment!

Parameters
benchmark- Dynamic benchmark name

Definition at line 80 of file executor.cpp.

Member Data Documentation

◆ _benchmarks

std::vector<std::shared_ptr<PhaseCore> > CppBenchmark::Executor::_benchmarks
protected

Registered benchmarks collection.

Definition at line 73 of file executor.h.

◆ _mutex

std::mutex CppBenchmark::Executor::_mutex
protected

Synchronization mutex.

Definition at line 71 of file executor.h.


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