changeset 105:6a768d3b4c61

Performance warning if runtime debug assertions are turned on
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 07 Sep 2016 09:17:25 +0200
parents 03a5a96a6bc4
children ac9bb4a5441d
files IndexPlugin/Plugin.cpp NEWS StoragePlugin/Plugin.cpp
diffstat 3 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/IndexPlugin/Plugin.cpp	Wed Jul 20 13:02:14 2016 +0200
+++ b/IndexPlugin/Plugin.cpp	Wed Sep 07 09:17:25 2016 +0200
@@ -29,11 +29,21 @@
 static OrthancPlugins::PostgreSQLWrapper* backend_ = NULL;
 
 
+static bool DisplayPerformanceWarning()
+{
+  (void) DisplayPerformanceWarning;   // Disable warning about unused function
+  OrthancPluginLogWarning(context_, "Performance warning in PostgreSQL index: "
+                          "Non-release build, runtime debug assertions are turned on");
+  return true;
+}
+
+
 extern "C"
 {
   ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* context)
   {
     context_ = context;
+    assert(DisplayPerformanceWarning());
 
     /* Check the version of the Orthanc core */
     if (OrthancPluginCheckVersion(context_) == 0)
--- a/NEWS	Wed Jul 20 13:02:14 2016 +0200
+++ b/NEWS	Wed Sep 07 09:17:25 2016 +0200
@@ -1,6 +1,8 @@
 Pending changes in the mainline
 ===============================
 
+* Performance warning if runtime debug assertions are turned on
+
 
 Release 2.0 (2015/12/02)
 ========================
--- a/StoragePlugin/Plugin.cpp	Wed Jul 20 13:02:14 2016 +0200
+++ b/StoragePlugin/Plugin.cpp	Wed Sep 07 09:17:25 2016 +0200
@@ -94,12 +94,21 @@
 }
 
 
+static bool DisplayPerformanceWarning()
+{
+  (void) DisplayPerformanceWarning;   // Disable warning about unused function
+  OrthancPluginLogWarning(context_, "Performance warning in PostgreSQL storage: "
+                          "Non-release build, runtime debug assertions are turned on");
+  return true;
+}
+
 
 extern "C"
 {
   ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* context)
   {
     context_ = context;
+    assert(DisplayPerformanceWarning());
 
     /* Check the version of the Orthanc core */
     if (OrthancPluginCheckVersion(context_) == 0)