aboutsummaryrefslogtreecommitdiff
path: root/framework/printers/JSONPrinter.cpp
diff options
context:
space:
mode:
authorMoritz Pflanzer <moritz.pflanzer@arm.com>2017-08-04 11:34:44 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-09-17 14:16:42 +0100
commit24a82463b683322a6bb11a103746ea9d9b3f53fb (patch)
treea444ba8dcc8c3cddd2540e722de49de7c0676e73 /framework/printers/JSONPrinter.cpp
parent4dfc235367e602a366952a8495679e339d7a7263 (diff)
downloadComputeLibrary-24a82463b683322a6bb11a103746ea9d9b3f53fb.tar.gz
COMPMID-415: Use printer for errors
Change-Id: Idc2fc1dfd5706580d15c2bbfffe2830d41075a4b Reviewed-on: http://mpd-gerrit.cambridge.arm.com/82908 Reviewed-by: Anthony Barbier <anthony.barbier@arm.com> Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Diffstat (limited to 'framework/printers/JSONPrinter.cpp')
-rw-r--r--framework/printers/JSONPrinter.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/framework/printers/JSONPrinter.cpp b/framework/printers/JSONPrinter.cpp
index 7806644418..3408174b48 100644
--- a/framework/printers/JSONPrinter.cpp
+++ b/framework/printers/JSONPrinter.cpp
@@ -78,6 +78,7 @@ void JSONPrinter::print_test_header(const TestInfo &info)
{
print_separator(_first_test);
+ _first_test_entry = true;
*_stream << R"(")" << info.name << R"(" : {)";
}
@@ -86,8 +87,32 @@ void JSONPrinter::print_test_footer()
*_stream << "}";
}
+void JSONPrinter::print_errors_header()
+{
+ print_separator(_first_test_entry);
+
+ _first_error = true;
+ *_stream << R"("errors" : [)";
+}
+
+void JSONPrinter::print_errors_footer()
+{
+ *_stream << "]";
+}
+
+void JSONPrinter::print_error(const std::exception &error)
+{
+ print_separator(_first_error);
+
+ *_stream << R"(")" << error.what() << R"(")";
+}
+
void JSONPrinter::print_measurements(const Profiler::MeasurementsMap &measurements)
{
+ print_separator(_first_test_entry);
+
+ *_stream << R"("measurements" : {)";
+
for(auto i_it = measurements.cbegin(), i_end = measurements.cend(); i_it != i_end;)
{
*_stream << R"(")" << i_it->first << R"(" : {)";
@@ -129,6 +154,8 @@ void JSONPrinter::print_measurements(const Profiler::MeasurementsMap &measuremen
*_stream << ",";
}
}
+
+ *_stream << "}";
}
} // namespace framework
} // namespace test