15 #include "benchmark/benchmark.h"
34 std::vector<std::string> elements = {
35 "name",
"iterations",
"real_time",
"cpu_time",
36 "time_unit",
"bytes_per_second",
"items_per_second",
"label",
37 "error_occurred",
"error_message"};
50 for (
const auto&
run : reports) {
51 for (
const auto& cnt :
run.counters) {
57 for (
auto B = elements.begin(); B != elements.end();) {
59 if (B != elements.end()) Out <<
",";
62 Out <<
",\"" << *B++ <<
"\"";
69 for (
const auto&
run : reports) {
70 for (
const auto& cnt :
run.counters) {
72 <<
"All counters must be present in each run. "
73 <<
"Counter named \"" << cnt.first
74 <<
"\" was not in a run after being added to the header";
80 for (
const auto&
run : reports) {
93 Out <<
'"' <<
name <<
"\",";
94 if (
run.error_occurred) {
99 Out <<
'"' <<
msg <<
"\"\n";
104 if (!
run.report_big_o && !
run.report_rms) {
105 Out <<
run.iterations;
109 Out <<
run.GetAdjustedRealTime() <<
",";
110 Out <<
run.GetAdjustedCPUTime() <<
",";
113 if (
run.report_big_o) {
115 }
else if (!
run.report_rms) {
120 if (
run.bytes_per_second > 0.0) {
121 Out <<
run.bytes_per_second;
124 if (
run.items_per_second > 0.0) {
125 Out <<
run.items_per_second;
128 if (!
run.report_label.empty()) {
133 Out <<
"\"" <<
label <<
"\"";
139 auto it =
run.counters.find(ucn);
140 if(
it ==
run.counters.end()) {
143 Out <<
"," <<
it->second;