From 0ae88bc06b41d210a123f008f6344cd765f543f0 Mon Sep 17 00:00:00 2001
From: Matej Ferencevic <matej.ferencevic@memgraph.io>
Date: Tue, 7 Nov 2017 18:46:13 +0100
Subject: [PATCH] Added apollo data to harness.

Reviewers: dgleich, teon.banek, buda

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D963
---
 .gitignore                       |  1 +
 tests/macro_benchmark/harness.py | 12 ++++++++++++
 2 files changed, 13 insertions(+)

diff --git a/.gitignore b/.gitignore
index 6f9a56ba9..51a92d238 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,3 +27,4 @@ ve/
 ve3/
 perf.data*
 TAGS
+*.apollo_data
diff --git a/tests/macro_benchmark/harness.py b/tests/macro_benchmark/harness.py
index a0597e2e8..75e1e4aa2 100755
--- a/tests/macro_benchmark/harness.py
+++ b/tests/macro_benchmark/harness.py
@@ -271,6 +271,18 @@ def main():
     with open(get_absolute_path(".harness_summary"), "w") as f:
         print(suite.summary, file=f)
 
+    # Export data points.
+    with open(get_absolute_path(".apollo_data"), "w") as f:
+        apollo_data = ""
+        data = list(filter(lambda x: x.strip(), suite.summary.split("\n")))
+        headers = data[0].strip().split()
+        for row in data[1:]:
+            row = row.strip().split()
+            group, scenario = row[0:2]
+            for header, value in zip(headers[2:], row[2:]):
+                apollo_data += "{}.{}.{} {}\n".format(group, scenario, header, value)
+        f.write(apollo_data)
+
 
 if __name__ == "__main__":
     main()