From ab52d325e0f99fbf2bfd6be9ae4d85bbbb92ff64 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A1nos=20Benjamin=20Antal?= <benjamin.antal@memgraph.io>
Date: Thu, 2 Mar 2023 11:22:36 +0100
Subject: [PATCH] Print and save response latencies

---
 tests/manual/query_performance.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/manual/query_performance.cpp b/tests/manual/query_performance.cpp
index b766d5fbb..8c7877b0d 100644
--- a/tests/manual/query_performance.cpp
+++ b/tests/manual/query_performance.cpp
@@ -74,6 +74,7 @@
 #include <istream>
 #include <thread>
 
+#include <fmt/core.h>
 #include <gflags/gflags.h>
 #include <spdlog/cfg/env.h>
 #include <spdlog/spdlog.h>
@@ -320,6 +321,8 @@ void RunV3() {
                    std::chrono::duration_cast<std::chrono::milliseconds>(benchmark_end - benchmark_start).count());
 
   ls.ShutDown();
+  auto latency_histograms = nlohmann::json::parse(fmt::format("{}", io.ResponseLatencies()));
+  spdlog::warn(latency_histograms.dump(4));
 
   if (!FLAGS_export_json_results.empty()) {
     nlohmann::json results;
@@ -329,6 +332,7 @@ void RunV3() {
       PutResult(benchmark_results_json, name, duration);
     }
     results["benchmarks"] = std::move(benchmark_results_json);
+    results["latencies"] = std::move(latency_histograms);
     std::ofstream results_file{FLAGS_export_json_results};
     results_file << results.dump();
   }