# HG changeset patch # User Sebastien Jodogne # Date 1548864349 -3600 # Node ID 569e17419eae2cb346c267cda5a1393a5f7f06fc # Parent fbdef056271745932b1ea1b632c20a43f92a3b14 test metrics diff -r fbdef0562717 -r 569e17419eae Framework/Common/DatabaseManager.cpp --- 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 + #include #include @@ -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(location_.GetLine())); + OrthancPlugins::MetricsTimer timer(name.c_str()); + #endif + */ + SetResult(GetTransaction().Execute(*statement_, parameters)); } catch (Orthanc::OrthancException& e) diff -r fbdef0562717 -r 569e17419eae Framework/PostgreSQL/PostgreSQLTransaction.cpp --- 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(); }