You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by cw...@apache.org on 2009/02/19 22:42:02 UTC

svn commit: r746007 - /incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/HandlerBase.java

Author: cwiklik
Date: Thu Feb 19 21:42:01 2009
New Revision: 746007

URL: http://svn.apache.org/viewvc?rev=746007&view=rev
Log:
UIMA-1194 Added code to accumulate time waiting for free CAS. Changed how analysis time is accumulated

Modified:
    incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/HandlerBase.java

Modified: incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/HandlerBase.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/HandlerBase.java?rev=746007&r1=746006&r2=746007&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/HandlerBase.java (original)
+++ incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/HandlerBase.java Thu Feb 19 21:42:01 2009
@@ -27,6 +27,7 @@
 import org.apache.uima.aae.controller.AnalysisEngineController;
 import org.apache.uima.aae.controller.Endpoint;
 import org.apache.uima.aae.controller.PrimitiveAnalysisEngineController;
+import org.apache.uima.aae.controller.LocalCache.CasStateEntry;
 import org.apache.uima.aae.error.AsynchAEException;
 import org.apache.uima.aae.error.ErrorContext;
 import org.apache.uima.aae.jmx.ServicePerformance;
@@ -300,9 +301,11 @@
 			if (aMessageContext.propertyExists(AsynchAEMessage.TimeWaitingForCAS))
 			{
 				long timeWaitingForCAS = ((Long) aMessageContext.getMessageLongProperty(AsynchAEMessage.TimeWaitingForCAS)).longValue();
-				if ( aMessageContext.getEndpoint().isRemote())
+				if ( timeWaitingForCAS > 0 && aMessageContext.getEndpoint().isRemote())
 				{
 					entry.incrementTimeWaitingForCAS(timeWaitingForCAS);
+					delegateServicePerformance.
+					  incrementCasPoolWaitTime(timeWaitingForCAS-delegateServicePerformance.getRawCasPoolWaitTime());
 					if ( inputCasEntry != null )
 					{
 						inputCasEntry.incrementTimeWaitingForCAS(timeWaitingForCAS);
@@ -317,15 +320,20 @@
 				{
 					if ( delegateServicePerformance != null )
 					{
-           delegateServicePerformance.incrementAnalysisTime(timeInProcessCAS);
-            //  The remote delegate returns the actual analysis time not the delta
-//					  delegateServicePerformance.setAnalysisTime(timeInProcessCAS);
+					  // calculate the time spent in analysis. The remote service returns total time
+					  // spent in the analysis. Compute the delta.
+					  long dt = timeInProcessCAS-delegateServicePerformance.getRawAnalysisTime();
+	          // increment total time in analysis 
+					  delegateServicePerformance.incrementAnalysisTime(dt);
+	          getController().getServicePerformance().incrementAnalysisTime(dt);
 					}
 				}
 				else 
 				{
 					getController().getServicePerformance().incrementAnalysisTime(timeInProcessCAS);
 				}
+				casStats.incrementAnalysisTime(timeInProcessCAS);
+				
 				if ( inputCasReferenceId != null )
 				{
 					ServicePerformance inputCasStats = 
@@ -334,10 +342,11 @@
 					// Update processing time for this CAS
 					if ( inputCasStats != null )
 					{
-//            inputCasStats.setAnalysisTime(timeInProcessCAS);
             inputCasStats.incrementAnalysisTime(timeInProcessCAS);
 					}
-				}
+				}				
+				
+				
 			}
 		}
 		catch( AsynchAEException e)