changeset 116:569e17419eae OrthancMySQL-2.0

test metrics
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 30 Jan 2019 17:05:49 +0100
parents fbdef0562717
children ca0ecd412988
files Framework/Common/DatabaseManager.cpp Framework/PostgreSQL/PostgreSQLTransaction.cpp
diffstat 2 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Common/DatabaseManager.cpp	Wed Jan 23 20:14:24 2019 +0100
+++ b/Framework/Common/DatabaseManager.cpp	Wed Jan 30 17:05:49 2019 +0100
@@ -21,6 +21,8 @@
 
 #include "DatabaseManager.h"
 
+#include <Plugins/Samples/Common/OrthancPluginCppWrapper.h>
+
 #include <Core/Logging.h>
 #include <Core/OrthancException.h>
 
@@ -510,6 +512,18 @@
       }
         
       assert(statement_ != NULL);
+
+      /*
+        TODO - Sample code to monitor the execution time of each
+        cached statement, and publish it as an Orthanc metrics
+
+        #if HAS_ORTHANC_PLUGIN_METRICS == 1
+        std::string name = (std::string(location_.GetFile()) + "_" +
+        boost::lexical_cast<std::string>(location_.GetLine()));
+        OrthancPlugins::MetricsTimer timer(name.c_str());
+        #endif
+      */
+
       SetResult(GetTransaction().Execute(*statement_, parameters));
     }
     catch (Orthanc::OrthancException& e)
--- a/Framework/PostgreSQL/PostgreSQLTransaction.cpp	Wed Jan 23 20:14:24 2019 +0100
+++ b/Framework/PostgreSQL/PostgreSQLTransaction.cpp	Wed Jan 30 17:05:49 2019 +0100
@@ -108,7 +108,7 @@
       readOnly_ = false;
     }
 
-  return result.release();
+    return result.release();
   }