From f2e13c80784f2466291f9b25f949f56583f80851 Mon Sep 17 00:00:00 2001 From: Dave Hladky Date: Fri, 22 Mar 2013 16:24:04 -0500 Subject: [PATCH] Issue #1813 Stats for FFMP were broken by memory updates. Change-Id: Idb213aa4b67760d1dc28f0f34bb473f970438a58 Former-commit-id: 314ec2517a0c5565f8423661cb744e04953f1830 --- .../META-INF/MANIFEST.MF | 6 ++- .../uf/edex/plugin/ffmp/FFMPGenerator.java | 39 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/META-INF/MANIFEST.MF index 969a862327..cda1339e5b 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/META-INF/MANIFEST.MF @@ -16,7 +16,11 @@ Require-Bundle: com.raytheon.uf.edex.cpgsrv;bundle-version="1.11.7";resolution:= com.raytheon.uf.common.dataplugin.ffmp;bundle-version="1.12.1174", com.raytheon.edex.plugin.radar;bundle-version="1.12.1174", com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0", - com.raytheon.uf.common.cache;bundle-version="1.12.1174" + com.raytheon.uf.common.cache;bundle-version="1.12.1174", + com.raytheon.uf.common.status;bundle-version="1.12.1174", + com.raytheon.uf.common.event;bundle-version="1.0.0", + com.raytheon.uf.edex.event;bundle-version="1.0.0", + com.raytheon.uf.common.stats;bundle-version="1.0.0" Import-Package: com.raytheon.uf.common.dataplugin.grid, com.raytheon.uf.common.ohd, com.raytheon.uf.common.status, diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/FFMPGenerator.java b/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/FFMPGenerator.java index 91e37ceed9..bbb5f8b4d2 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/FFMPGenerator.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/FFMPGenerator.java @@ -58,6 +58,7 @@ import com.raytheon.uf.common.datastorage.StorageProperties; import com.raytheon.uf.common.datastorage.StorageProperties.Compression; import com.raytheon.uf.common.datastorage.records.ByteDataRecord; import com.raytheon.uf.common.datastorage.records.IDataRecord; +import com.raytheon.uf.common.event.EventBus; import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.LocalizationContext; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; @@ -82,6 +83,7 @@ import com.raytheon.uf.common.monitor.xml.SourceIngestConfigXML; import com.raytheon.uf.common.monitor.xml.SourceXML; import com.raytheon.uf.common.serialization.SerializationException; import com.raytheon.uf.common.serialization.SerializationUtil; +import com.raytheon.uf.common.stats.ProcessEvent; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; @@ -120,6 +122,7 @@ import com.raytheon.uf.edex.plugin.ffmp.common.FFTIRatioDiff; * 02/20/13 1635 D. Hladky Added some finally methods to increase dead lock safety. Reduced wait times for threads. * 02/25/13 1660 D. Hladky Redesigned data flow for FFTI in order to have only one mosaic piece in memory at a time. * 03/13/13 1478 D. Hladky non-FFTI mosaic containers weren't getting ejected. Made it so that they are ejected after processing as well. + * 03/22/13 1803 D. Hladky Fixed broken performance logging for ffmp. * * * @author dhladky @@ -2043,6 +2046,42 @@ public class FFMPGenerator extends CompositeProductGenerator implements return sourceSiteDataKey; } + + /** + * Log process statistics + * + * @param message + */ + @Override + public void log(URIGenerateMessage message) { + + long curTime = System.currentTimeMillis(); + ProcessEvent processEvent = new ProcessEvent(); + + if (productType != null) { + processEvent.setDataType(productType); + } + + Long dequeueTime = message.getDeQueuedTime(); + if (dequeueTime != null) { + long elapsedMilliseconds = curTime - dequeueTime; + processEvent.setProcessingTime(elapsedMilliseconds); + } + + Long enqueueTime = message.getEnQueuedTime(); + if (enqueueTime != null) { + long latencyMilliseconds = curTime - enqueueTime; + processEvent.setProcessingLatency(latencyMilliseconds); + } + + // processing in less than 0 millis isn't trackable, usually due to + // an + // error occurred and statement logged incorrectly + if ((processEvent.getProcessingLatency() > 0) + && (processEvent.getProcessingTime() > 0)) { + EventBus.publish(processEvent); + } + } }