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

Console launcher. More...

#include <launcher_console.h>

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

Public Member Functions

 LauncherConsole (const LauncherConsole &)=delete
 
 LauncherConsole (LauncherConsole &&)=delete
 
virtual ~LauncherConsole ()=default
 
LauncherConsoleoperator= (const LauncherConsole &)=delete
 
LauncherConsoleoperator= (LauncherConsole &&)=delete
 
void Initialize (const int argc, char const *const *const argv)
 Initialized console launcher. More...
 
void Execute ()
 Execute benchmarks and show progress in console. More...
 
void Report () const
 Report benchmarks results in console. More...
 
- Public Member Functions inherited from CppBenchmark::Launcher
 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
 

Static Public Member Functions

static LauncherConsoleGetInstance ()
 Get singleton instance. More...
 

Protected Member Functions

void onLaunching (int current, int total, const BenchmarkBase &benchmark, const Context &context, int attempt) override
 Handle benchmark launching notification. More...
 
void onLaunched (int current, int total, const BenchmarkBase &benchmark, const Context &context, int attempt) override
 Handle benchmark launched notification. More...
 

Additional Inherited Members

- Protected Attributes inherited from CppBenchmark::Launcher
std::vector< std::shared_ptr< BenchmarkBase > > _benchmarks
 Registered benchmarks collection. More...
 
std::vector< std::function< std::shared_ptr< BenchmarkBase >)> > _builders
 Benchmark builders collection. More...
 

Detailed Description

Console launcher.

Console launcher uses console output to show benchmarks running progress and sending reports to standard output. It can also parse command line arguments to provide additional launching options and different report formats.

Definition at line 21 of file launcher_console.h.

Constructor & Destructor Documentation

◆ LauncherConsole() [1/2]

CppBenchmark::LauncherConsole::LauncherConsole ( const LauncherConsole )
delete

◆ LauncherConsole() [2/2]

CppBenchmark::LauncherConsole::LauncherConsole ( LauncherConsole &&  )
delete

◆ ~LauncherConsole()

virtual CppBenchmark::LauncherConsole::~LauncherConsole ( )
virtualdefault

Member Function Documentation

◆ Execute()

void CppBenchmark::LauncherConsole::Execute ( )

Execute benchmarks and show progress in console.

Definition at line 64 of file launcher_console.cpp.

◆ GetInstance()

static LauncherConsole& CppBenchmark::LauncherConsole::GetInstance ( )
inlinestatic

Get singleton instance.

Definition at line 32 of file launcher_console.h.

◆ Initialize()

void CppBenchmark::LauncherConsole::Initialize ( const int  argc,
char const *const *const  argv 
)

Initialized console launcher.

This method should be called once from main() function to initialize console launcher with command line arguments!

See also
BENCHMARK_MAIN()
Parameters
argc- Arguments count
argv- Arguments values

Definition at line 24 of file launcher_console.cpp.

◆ onLaunched()

void CppBenchmark::LauncherConsole::onLaunched ( int  current,
int  total,
const BenchmarkBase benchmark,
const Context context,
int  attempt 
)
overrideprotectedvirtual

Handle benchmark launched notification.

This method is called after launched the given benchmark.

Parameters
current- Current benchmark number
total- Total benchmarks
benchmark- Benchmark
context- Benchmark running context
attempt- Benchmark attempt

Reimplemented from CppBenchmark::LauncherHandler.

Definition at line 115 of file launcher_console.cpp.

◆ onLaunching()

void CppBenchmark::LauncherConsole::onLaunching ( int  current,
int  total,
const BenchmarkBase benchmark,
const Context context,
int  attempt 
)
overrideprotectedvirtual

Handle benchmark launching notification.

This method is called before launching the given benchmark.

Parameters
current- Current benchmark number
total- Total benchmarks
benchmark- Benchmark
context- Benchmark running context
attempt- Benchmark attempt

Reimplemented from CppBenchmark::LauncherHandler.

Definition at line 107 of file launcher_console.cpp.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ Report()

void CppBenchmark::LauncherConsole::Report ( ) const

Report benchmarks results in console.

Definition at line 84 of file launcher_console.cpp.


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