From d7d7b842a4f8473a57701226718114763a786c3b Mon Sep 17 00:00:00 2001
From: brinn <brinn>
Date: Tue, 25 Oct 2011 18:05:30 +0000
Subject: [PATCH] add: log messages to get some performance numbers on why
 getting image metadata is so slow

SVN: 23432
---
 .../server/DssServiceRpcScreening.java        | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/screening/server/DssServiceRpcScreening.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/screening/server/DssServiceRpcScreening.java
index 674a69f297e..17ba89c9900 100644
--- a/screening/source/java/ch/systemsx/cisd/openbis/dss/screening/server/DssServiceRpcScreening.java
+++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/screening/server/DssServiceRpcScreening.java
@@ -237,11 +237,40 @@ public class DssServiceRpcScreening extends AbstractDssServiceRpc<IDssServiceRpc
     private ImageDatasetMetadata extractImageMetadata(IImageDatasetIdentifier dataset,
             File datasetRoot)
     {
+        long start = System.currentTimeMillis();
         final IImagingDatasetLoader imageAccessor =
                 createImageLoader(dataset.getDatasetCode(), datasetRoot);
+
+        if (operationLog.isInfoEnabled())
+        {
+            operationLog.info(String.format(
+                    "extractImageMetadata(): createImageLoader() took %.2f s",
+                    (System.currentTimeMillis() - start) / 1000.0));
+        }
+        start = System.currentTimeMillis();
         final Size imageSize = getOriginalImageSize(dataset, imageAccessor);
+        if (operationLog.isInfoEnabled())
+        {
+            operationLog.info(String.format(
+                    "extractImageMetadata(): getOriginalImageSize() took %.2f s",
+                    (System.currentTimeMillis() - start) / 1000.0));
+        }
+        start = System.currentTimeMillis();
         final Size thumbnailSize = getThumbnailImageSize(dataset, imageAccessor);
+        if (operationLog.isInfoEnabled())
+        {
+            operationLog.info(String.format(
+                    "extractImageMetadata(): getThumbnailImageSize() took %.2f s",
+                    (System.currentTimeMillis() - start) / 1000.0));
+        }
+        start = System.currentTimeMillis();
         final ImageDatasetParameters params = imageAccessor.getImageParameters();
+        if (operationLog.isInfoEnabled())
+        {
+            operationLog.info(String.format(
+                    "extractImageMetadata(): getImageParameters() took %.2f s",
+                    (System.currentTimeMillis() - start) / 1000.0));
+        }
         return new ImageDatasetMetadata(dataset, toPublicChannels(params.getInternalChannels()),
                 params.getTileRowsNum(), params.getTileColsNum(), imageSize.getWidth(),
                 imageSize.getHeight(), thumbnailSize.getWidth(), thumbnailSize.getHeight());
-- 
GitLab