aboutsummaryrefslogtreecommitdiffstats
path: root/src/cli
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-12-18 09:02:26 -0500
committerJack Lloyd <[email protected]>2017-12-18 09:02:26 -0500
commita738ad098d35fac318a97c5d5c5c0cc329c5c043 (patch)
tree1d5f54ff78b401801ae54a1957c19967790d5626 /src/cli
parent8a30a2d229a51b5ae0f23b71591d9ed8f08c3126 (diff)
Correct JSON output (trailing comma) and add byte-per-second value
Diffstat (limited to 'src/cli')
-rw-r--r--src/cli/speed.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/cli/speed.cpp b/src/cli/speed.cpp
index 894fc3ef4..bb4a42344 100644
--- a/src/cli/speed.cpp
+++ b/src/cli/speed.cpp
@@ -391,9 +391,13 @@ class JSON_Output final
std::ostringstream out;
out << "[\n";
- for(const Timer& t : m_results)
+
+ for(size_t i = 0; i != m_results.size(); ++i)
{
- //out << t.format_json();
+ if(i != 0)
+ out << ",";
+
+ const Timer& t = m_results[i];
out << '{';
out << "\"algo\": \"" << t.get_name() << "\", ";
@@ -403,11 +407,14 @@ class JSON_Output final
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 << "},\n";
+ out << "}\n";
}
out << "]\n";