From 17bafdf6b8a4b353eba9fb2fd2d94dca26fd4a32 Mon Sep 17 00:00:00 2001
From: Martin Bauer <martin.bauer@fau.de>
Date: Fri, 1 Dec 2017 13:36:15 +0100
Subject: [PATCH] Added sqlite output to ProbeVsExtraMessage test/benchmark

---
 tests/core/CMakeLists.txt              |  2 +-
 tests/core/mpi/ProbeVsExtraMessage.cpp | 19 ++++++++++++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/tests/core/CMakeLists.txt b/tests/core/CMakeLists.txt
index 80ddaa4ef..f81f11461 100644
--- a/tests/core/CMakeLists.txt
+++ b/tests/core/CMakeLists.txt
@@ -142,7 +142,7 @@ waLBerla_execute_test( NAME SetReductionTest27 COMMAND $<TARGET_FILE:SetReductio
 
 
 
-waLBerla_compile_test( FILES mpi/ProbeVsExtraMessage.cpp )
+waLBerla_compile_test( FILES mpi/ProbeVsExtraMessage.cpp DEPENDS postprocessing)
 
 
 ##############
diff --git a/tests/core/mpi/ProbeVsExtraMessage.cpp b/tests/core/mpi/ProbeVsExtraMessage.cpp
index 52dca3b02..d05f2c875 100644
--- a/tests/core/mpi/ProbeVsExtraMessage.cpp
+++ b/tests/core/mpi/ProbeVsExtraMessage.cpp
@@ -25,6 +25,7 @@
 #include "core/mpi/MPIManager.h"
 #include "core/math/Random.h"
 #include "core/timing/TimingPool.h"
+#include "postprocessing/sqlite/SQLite.h"
 
 #include <iostream>
 #include <sstream>
@@ -166,7 +167,7 @@ int main( int argc, char ** argv )
    using namespace std;
 
    WALBERLA_ROOT_SECTION() {
-      if ( argc != 3 ) {
+      if ( argc != 3 && argc != 4 ) {
          cerr << "Wrong number of arguments " << endl;
          cerr << "Usage ./probeVsExtraMessage <iterations> <messageSize> " << endl;
       }
@@ -185,9 +186,25 @@ int main( int argc, char ** argv )
    twoMessageVersion     ( iterations, messageSize, tp );
    maxMessageSizeVersion ( iterations, messageSize, tp );
 
+
+
    WALBERLA_ROOT_SECTION() {
       cout << tp << endl;
    }
+   if( argc == 4) {
+
+      const auto reducedTimeloopTiming = tp.getReduced();
+      WALBERLA_ROOT_SECTION() {
+         std::string dbFile( argv[3] );
+         std::map<std::string, walberla::int64_t> integerProperties;
+         integerProperties["iterations"] = int64_c(iterations);
+         integerProperties["messageSize"] = int64_c(messageSize);
+         integerProperties["processes"] = int64_c(mpi::MPIManager::instance()->numProcesses());
+         postprocessing::SQLiteDB db( dbFile );
+         auto runid = db.storeRun( integerProperties, std::map<std::string, std::string>(), std::map<string, double>());
+         db.storeTimingPool( runid, *reducedTimeloopTiming, "timings" );
+      }
+   }
 
    return 0;
 }
-- 
GitLab