diff OrthancServer/Sources/ServerContext.cpp @ 4941:96a3e81eba90 more-tags

performance warning
author Alain Mazy <am@osimis.io>
date Wed, 16 Mar 2022 09:50:33 +0100
parents 304514ce84ee
children f377d5643538
line wrap: on
line diff
--- a/OrthancServer/Sources/ServerContext.cpp	Tue Mar 15 15:57:21 2022 +0100
+++ b/OrthancServer/Sources/ServerContext.cpp	Wed Mar 16 09:50:33 2022 +0100
@@ -2546,6 +2546,26 @@
       // possibly merge missing requested tags from dicom-as-json
       if (!resource.missingRequestedTags_.empty() && !DicomMap::HasOnlyComputedTags(resource.missingRequestedTags_))
       {
+        OrthancConfiguration::ReaderLock lock;
+        if (lock.GetConfiguration().IsStorageAccessOnFindLogsEnabled())
+        {
+          std::set<DicomTag> missingTags;
+          Toolbox::AppendSets(missingTags, resource.missingRequestedTags_);
+          for (std::set<DicomTag>::const_iterator it = resource.missingRequestedTags_.begin(); it != resource.missingRequestedTags_.end(); it++)
+          {
+            if (DicomMap::IsComputedTag(*it))
+            {
+              missingTags.erase(*it);
+            }
+          }
+
+          std::string missings;
+          FromDcmtkBridge::FormatListOfTags(missings, missingTags);
+
+          LOG(WARNING) << "PERFORMANCE WARNING: Accessing Dicom tags from storage when accessing " << Orthanc::GetResourceTypeText(resource.type_, false , false) << " : " << missings;
+        }
+
+
         std::string instanceId_ = instanceId;
         DicomMap tagsFromJson;
 
@@ -2569,7 +2589,6 @@
             }
           }
   
-          // MORE_TAGS :TODO: log "performance" warning (add an option to disable them)
           Json::Value tmpDicomAsJson;
           ReadDicomAsJson(tmpDicomAsJson, instanceId_);
           tagsFromJson.FromDicomAsJson(tmpDicomAsJson);