aboutsummaryrefslogtreecommitdiffstats
path: root/src/cli
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2021-03-03 19:10:01 -0500
committerJack Lloyd <[email protected]>2021-03-03 19:10:01 -0500
commitb6f31c1f448908ee86b92e4bcd2cc3242b73c11f (patch)
tree9a8ba65ea7aa9383aed74b3dca9283fd19792e29 /src/cli
parent67b841e3a3f42c1c74ead3caf3343baa76fbd227 (diff)
Clean up the JSON output from speed cli
Diffstat (limited to 'src/cli')
-rw-r--r--src/cli/speed.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/cli/speed.cpp b/src/cli/speed.cpp
index 5995fdefc..4a22fb57f 100644
--- a/src/cli/speed.cpp
+++ b/src/cli/speed.cpp
@@ -154,27 +154,28 @@ class JSON_Output final
for(size_t i = 0; i != m_results.size(); ++i)
{
- if(i != 0)
- out << ",";
-
const Timer& t = m_results[i];
- out << '{';
- out << "\"algo\": \"" << t.get_name() << "\", ";
- out << "\"op\": \"" << t.doing() << "\", ";
+ out << "{"
+ << "\"algo\": \"" << t.get_name() << "\", "
+ << "\"op\": \"" << t.doing() << "\", "
+ << "\"events\": " << t.events() << ", ";
- out << "\"events\": " << t.events() << ", ";
if(t.cycles_consumed() > 0)
out << "\"cycles\": " << t.cycles_consumed() << ", ";
+
if(t.buf_size() > 0)
{
out << "\"bps\": " << static_cast<uint64_t>(t.events() / (t.value() / 1000000000.0)) << ", ";
out << "\"buf_size\": " << t.buf_size() << ", ";
}
- out << "\"nanos\": " << t.value();
+ out << "\"nanos\": " << t.value() << "}";
+
+ if(i != m_results.size() - 1)
+ out << ",";
- out << "}\n";
+ out << "\n";
}
out << "]\n";