CppBenchmark  1.0.4.0
C++ Benchmark Library
reporter_csv.cpp
Go to the documentation of this file.
1 
10 
11 namespace CppBenchmark {
12 
14 {
15  _stream << "name,avg_time,min_time,max_time,total_time,total_operations,total_items,total_bytes,operations_per_second,items_per_second,bytes_per_second\n";
16 }
17 
18 void ReporterCSV::ReportPhase(const PhaseCore& phase, const PhaseMetrics& metrics)
19 {
20  _stream << '"' << phase.name() << '"' << ',';
21 
22  if (metrics.latency())
23  {
24  _stream
25  << metrics.min_latency() << ','
26  << metrics.max_latency() << ','
27  << metrics.mean_latency() << ','
28  << metrics.stdv_latency() << ',';
29  }
30  else
31  {
32  _stream
33  << metrics.avg_time() << ','
34  << metrics.min_time() << ','
35  << metrics.max_time() << ',';
36  }
37 
38  _stream
39  << metrics.total_time() << ','
40  << metrics.total_operations() << ','
41  << metrics.total_items() << ','
42  << metrics.total_bytes() << ','
43  << metrics.operations_per_second() << ','
44  << metrics.items_per_second() << ','
45  << metrics.bytes_per_second() << '\n';
46 }
47 
48 } // namespace CppBenchmark
Benchmark phase core.
Definition: phase_core.h:27
const std::string & name() const noexcept override
Get phase name.
Definition: phase_core.h:53
Benchmark phase metrics.
Definition: phase_metrics.h:37
int64_t total_bytes() const noexcept
Get total bytes processed in the phase.
Definition: phase_metrics.h:75
double mean_latency() const noexcept
Get latency mean value of the phase execution.
int64_t total_time() const noexcept
Get total time of the phase execution.
Definition: phase_metrics.h:69
int64_t min_time() const noexcept
Get minimal time of the phase execution.
int64_t min_latency() const noexcept
Get latency minimal value of the phase execution.
double stdv_latency() const noexcept
Get latency standard deviation of the phase execution.
int64_t max_latency() const noexcept
Get latency maximal value of the phase execution.
int64_t total_items() const noexcept
Get total items processed in the phase.
Definition: phase_metrics.h:73
int64_t avg_time() const noexcept
Get average time of the phase execution.
int64_t max_time() const noexcept
Get maximal time of the phase execution.
int64_t bytes_per_second() const noexcept
Get data throughput (bytes / second)
int64_t items_per_second() const noexcept
Get items throughput (items / second)
int64_t operations_per_second() const noexcept
Get operations throughput (operations / second)
bool latency() const noexcept
Is metrics contains latency values?
int64_t total_operations() const noexcept
Get total operations made in the phase.
Definition: phase_metrics.h:71
void ReportPhase(const PhaseCore &phase, const PhaseMetrics &metrics) override
Report current phase information.
void ReportHeader() override
Report header.
C++ Benchmark project definitions.
Definition: barrier.h:15
Comma-separated values (CSV) reporter definition.