CppBenchmark  1.0.4.0
C++ Benchmark Library
reporter_console.h
Go to the documentation of this file.
1 
9 #ifndef CPPBENCHMARK_REPORTER_CONSOLE_H
10 #define CPPBENCHMARK_REPORTER_CONSOLE_H
11 
12 #include "benchmark/reporter.h"
13 
14 #include <iostream>
15 
16 namespace CppBenchmark {
17 
19 
23 class ReporterConsole : public Reporter
24 {
25 public:
27 
32  ReporterConsole(std::ostream& stream = std::cout) : _stream(stream) {}
33  ReporterConsole(const ReporterConsole&) = delete;
35  virtual ~ReporterConsole() = default;
36 
39 
40  // Implementation of Reporter
41  void ReportHeader() override;
42  void ReportSystem() override;
43  void ReportEnvironment() override;
44  void ReportBenchmark(const BenchmarkBase& benchmark, const Settings& settings) override;
45  void ReportPhase(const PhaseCore& phase, const PhaseMetrics& metrics) override;
46  void ReportFooter() override;
47 
49 
55  static std::string GenerateSeparator(char ch);
57 
63  static std::string GenerateClockSpeed(int64_t hertz);
65 
71  static std::string GenerateDataSize(int64_t bytes);
73 
79  static std::string GenerateTimePeriod(int64_t nanoseconds);
80 
81 private:
82  std::ostream& _stream;
83 };
84 
85 } // namespace CppBenchmark
86 
87 #endif // CPPBENCHMARK_REPORTER_CONSOLE_H
Benchmark base class.
Benchmark phase core.
Definition: phase_core.h:27
Benchmark phase metrics.
Definition: phase_metrics.h:37
ReporterConsole(std::ostream &stream=std::cout)
Default class constructor.
static std::string GenerateClockSpeed(int64_t hertz)
Generate clock speed string.
void ReportBenchmark(const BenchmarkBase &benchmark, const Settings &settings) override
Report current benchmark information.
ReporterConsole(const ReporterConsole &)=delete
virtual ~ReporterConsole()=default
static std::string GenerateSeparator(char ch)
Generate separator string.
void ReportEnvironment() override
Report environment information.
void ReportHeader() override
Report header.
void ReportPhase(const PhaseCore &phase, const PhaseMetrics &metrics) override
Report current phase information.
ReporterConsole & operator=(const ReporterConsole &)=delete
static std::string GenerateTimePeriod(int64_t nanoseconds)
Generate time period string.
void ReportSystem() override
Report system information.
ReporterConsole & operator=(ReporterConsole &&)=delete
void ReportFooter() override
Report footer.
static std::string GenerateDataSize(int64_t bytes)
Generate data size string.
ReporterConsole(ReporterConsole &&)=delete
Reporter base class.
Definition: reporter.h:21
Benchmark settings.
Definition: settings.h:32
C++ Benchmark project definitions.
Definition: barrier.h:15
Reporter base definition.