summaryrefslogtreecommitdiffstats
path: root/lib/libcxx/utils/google-benchmark/src/csv_reporter.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libcxx/utils/google-benchmark/src/csv_reporter.cc')
-rw-r--r--lib/libcxx/utils/google-benchmark/src/csv_reporter.cc29
1 files changed, 16 insertions, 13 deletions
diff --git a/lib/libcxx/utils/google-benchmark/src/csv_reporter.cc b/lib/libcxx/utils/google-benchmark/src/csv_reporter.cc
index 6779815b3c3..4a641909d80 100644
--- a/lib/libcxx/utils/google-benchmark/src/csv_reporter.cc
+++ b/lib/libcxx/utils/google-benchmark/src/csv_reporter.cc
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#include "benchmark/reporter.h"
+#include "benchmark/benchmark.h"
#include "complexity.h"
#include <algorithm>
@@ -22,9 +22,9 @@
#include <tuple>
#include <vector>
+#include "check.h"
#include "string_util.h"
#include "timers.h"
-#include "check.h"
// File format reference: http://edoceo.com/utilitas/csv-file-format.
@@ -35,14 +35,14 @@ std::vector<std::string> elements = {
"name", "iterations", "real_time", "cpu_time",
"time_unit", "bytes_per_second", "items_per_second", "label",
"error_occurred", "error_message"};
-}
+} // namespace
bool CSVReporter::ReportContext(const Context& context) {
PrintBasicContext(&GetErrorStream(), context);
return true;
}
-void CSVReporter::ReportRuns(const std::vector<Run> & reports) {
+void CSVReporter::ReportRuns(const std::vector<Run>& reports) {
std::ostream& Out = GetOutputStream();
if (!printed_header_) {
@@ -58,7 +58,8 @@ void CSVReporter::ReportRuns(const std::vector<Run> & reports) {
Out << *B++;
if (B != elements.end()) Out << ",";
}
- for (auto B = user_counter_names_.begin(); B != user_counter_names_.end();) {
+ for (auto B = user_counter_names_.begin();
+ B != user_counter_names_.end();) {
Out << ",\"" << *B++ << "\"";
}
Out << "\n";
@@ -69,9 +70,9 @@ void CSVReporter::ReportRuns(const std::vector<Run> & reports) {
for (const auto& run : reports) {
for (const auto& cnt : run.counters) {
CHECK(user_counter_names_.find(cnt.first) != user_counter_names_.end())
- << "All counters must be present in each run. "
- << "Counter named \"" << cnt.first
- << "\" was not in a run after being added to the header";
+ << "All counters must be present in each run. "
+ << "Counter named \"" << cnt.first
+ << "\" was not in a run after being added to the header";
}
}
}
@@ -80,10 +81,9 @@ void CSVReporter::ReportRuns(const std::vector<Run> & reports) {
for (const auto& run : reports) {
PrintRunData(run);
}
-
}
-void CSVReporter::PrintRunData(const Run & run) {
+void CSVReporter::PrintRunData(const Run& run) {
std::ostream& Out = GetOutputStream();
// Field with embedded double-quote characters must be doubled and the field
@@ -135,10 +135,13 @@ void CSVReporter::PrintRunData(const Run & run) {
Out << ",,"; // for error_occurred and error_message
// Print user counters
- for (const auto &ucn : user_counter_names_) {
+ for (const auto& ucn : user_counter_names_) {
auto it = run.counters.find(ucn);
- CHECK(it != run.counters.end());
- Out << "," << it->second;
+ if (it == run.counters.end()) {
+ Out << ",";
+ } else {
+ Out << "," << it->second;
+ }
}
Out << '\n';
}