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

Console reporter. More...

#include <reporter_console.h>

Inheritance diagram for CppBenchmark::ReporterConsole:
CppBenchmark::Reporter

Public Member Functions

 ReporterConsole (std::ostream &stream=std::cout)
 Default class constructor. More...
 
 ReporterConsole (const ReporterConsole &)=delete
 
 ReporterConsole (ReporterConsole &&)=delete
 
virtual ~ReporterConsole ()=default
 
ReporterConsoleoperator= (const ReporterConsole &)=delete
 
ReporterConsoleoperator= (ReporterConsole &&)=delete
 
void ReportHeader () override
 Report header. More...
 
void ReportSystem () override
 Report system information. More...
 
void ReportEnvironment () override
 Report environment information. More...
 
void ReportBenchmark (const BenchmarkBase &benchmark, const Settings &settings) override
 Report current benchmark information. More...
 
void ReportPhase (const PhaseCore &phase, const PhaseMetrics &metrics) override
 Report current phase information. More...
 
void ReportFooter () override
 Report footer. More...
 
- Public Member Functions inherited from CppBenchmark::Reporter
 Reporter ()=default
 
 Reporter (const Reporter &)=delete
 
 Reporter (Reporter &&)=delete
 
virtual ~Reporter ()=default
 
Reporteroperator= (const Reporter &)=delete
 
Reporteroperator= (Reporter &&)=delete
 
virtual void ReportBenchmarksHeader ()
 Report all benchmarks header. More...
 
virtual void ReportBenchmarksFooter ()
 Report all benchmarks footer. More...
 
virtual void ReportBenchmarkHeader ()
 Report current benchmark header. More...
 
virtual void ReportBenchmarkFooter ()
 Report current benchmark footer. More...
 
virtual void ReportPhasesHeader ()
 Report all phases header. More...
 
virtual void ReportPhasesFooter ()
 Report all phases footer. More...
 
virtual void ReportPhaseHeader ()
 Report current phase header. More...
 
virtual void ReportPhaseFooter ()
 Report current phase footer. More...
 

Static Public Member Functions

static std::string GenerateSeparator (char ch)
 Generate separator string. More...
 
static std::string GenerateClockSpeed (int64_t hertz)
 Generate clock speed string. More...
 
static std::string GenerateDataSize (int64_t bytes)
 Generate data size string. More...
 
static std::string GenerateTimePeriod (int64_t nanoseconds)
 Generate time period string. More...
 

Detailed Description

Console reporter.

Console reporter uses console output to show benchmarks results. If it is possible results are presented in different colors.

Definition at line 23 of file reporter_console.h.

Constructor & Destructor Documentation

◆ ReporterConsole() [1/3]

CppBenchmark::ReporterConsole::ReporterConsole ( std::ostream &  stream = std::cout)
inline

Default class constructor.

Initialize reporter with an output stream. Default output stream is std::cout.

Parameters
stream- Output stream

Definition at line 32 of file reporter_console.h.

◆ ReporterConsole() [2/3]

CppBenchmark::ReporterConsole::ReporterConsole ( const ReporterConsole )
delete

◆ ReporterConsole() [3/3]

CppBenchmark::ReporterConsole::ReporterConsole ( ReporterConsole &&  )
delete

◆ ~ReporterConsole()

virtual CppBenchmark::ReporterConsole::~ReporterConsole ( )
virtualdefault

Member Function Documentation

◆ GenerateClockSpeed()

std::string CppBenchmark::ReporterConsole::GenerateClockSpeed ( int64_t  hertz)
static

Generate clock speed string.

Will return a pretty string of Hz, kHz, MHz, GHz based on the given clock speed in hertz.

Parameters
hertz- Clock speed value in hertz
Returns
String with clock speed representation

Definition at line 152 of file reporter_console.cpp.

◆ GenerateDataSize()

std::string CppBenchmark::ReporterConsole::GenerateDataSize ( int64_t  bytes)
static

Generate data size string.

Will return a pretty string of bytes, KiB, MiB, GiB, TiB based on the given bytes.

Parameters
bytes- Data size in bytes
Returns
String with data size representation

Definition at line 182 of file reporter_console.cpp.

◆ GenerateSeparator()

std::string CppBenchmark::ReporterConsole::GenerateSeparator ( char  ch)
static

Generate separator string.

Will return a string of 79 given characters.

Parameters
ch- Separator character
Returns
String separator

Definition at line 147 of file reporter_console.cpp.

◆ GenerateTimePeriod()

std::string CppBenchmark::ReporterConsole::GenerateTimePeriod ( int64_t  nanoseconds)
static

Generate time period string.

Will return a pretty string of ns, mcs, ms, s, m, h based on the given nanoseconds.

Parameters
nanoseconds- Time period in nanoseconds
Returns
String with time period representation

Definition at line 218 of file reporter_console.cpp.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ ReportBenchmark()

void CppBenchmark::ReporterConsole::ReportBenchmark ( const BenchmarkBase benchmark,
const Settings settings 
)
overridevirtual

Report current benchmark information.

Parameters
benchmark- Current benchmark
settings- Current benchmark settings

Reimplemented from CppBenchmark::Reporter.

Definition at line 50 of file reporter_console.cpp.

◆ ReportEnvironment()

void CppBenchmark::ReporterConsole::ReportEnvironment ( )
overridevirtual

Report environment information.

Reimplemented from CppBenchmark::Reporter.

Definition at line 38 of file reporter_console.cpp.

◆ ReportFooter()

void CppBenchmark::ReporterConsole::ReportFooter ( )
overridevirtual

Report footer.

Reimplemented from CppBenchmark::Reporter.

Definition at line 142 of file reporter_console.cpp.

◆ ReportHeader()

void CppBenchmark::ReporterConsole::ReportHeader ( )
overridevirtual

Report header.

Reimplemented from CppBenchmark::Reporter.

Definition at line 20 of file reporter_console.cpp.

◆ ReportPhase()

void CppBenchmark::ReporterConsole::ReportPhase ( const PhaseCore phase,
const PhaseMetrics metrics 
)
overridevirtual

Report current phase information.

Parameters
phase- Current phase
metrics- Current phase metrics

Implements CppBenchmark::Reporter.

Definition at line 61 of file reporter_console.cpp.

◆ ReportSystem()

void CppBenchmark::ReporterConsole::ReportSystem ( )
overridevirtual

Report system information.

Reimplemented from CppBenchmark::Reporter.

Definition at line 26 of file reporter_console.cpp.


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