From e4e9b2ebc7d41715fc0c0c8ba07f897fe63a688e Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Wed, 16 Jan 2008 23:19:50 +0000
Subject: [PATCH] This fix removes the option to use nanosecond etime resolution as a JVM property. It is now a global configuration attribute. Due to the 10% throughput decrease I saw when using System.nanoTime, the default still uses System.currentTimeMillis to timestamp operations. System.nanoTime will only be used when the ds-cfg-etime-resolution attribute is set to nano-seconds.

---
 opends/src/server/org/opends/server/core/SearchOperationBasis.java |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/opends/src/server/org/opends/server/core/SearchOperationBasis.java b/opends/src/server/org/opends/server/core/SearchOperationBasis.java
index b3244ac..927fa69 100644
--- a/opends/src/server/org/opends/server/core/SearchOperationBasis.java
+++ b/opends/src/server/org/opends/server/core/SearchOperationBasis.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Portions Copyright 2007 Sun Microsystems, Inc.
+ *      Portions Copyright 2006-2008 Sun Microsystems, Inc.
  */
 package org.opends.server.core;
 
@@ -627,8 +627,9 @@
 
     // See if the time limit has expired.  If so, then don't send the entry and
     // indicate that the search should end.
-    if ((getTimeLimit() > 0) && (TimeThread.getTime() >=
-                                                getTimeLimitExpiration()))
+    if ((getTimeLimit() > 0) &&
+        ((getUseNanoTime() ? TimeThread.getNanoTime() :
+                             TimeThread.getTime()) >= getTimeLimitExpiration()))
     {
       setResultCode(ResultCode.TIME_LIMIT_EXCEEDED);
       appendErrorMessage(ERR_SEARCH_TIME_LIMIT_EXCEEDED.get(getTimeLimit()));
@@ -1054,8 +1055,9 @@
 
     // See if the time limit has expired.  If so, then don't send the entry and
     // indicate that the search should end.
-    if ((getTimeLimit() > 0) && (TimeThread.getTime() >=
-                                        getTimeLimitExpiration()))
+    if ((getTimeLimit() > 0) &&
+        ((getUseNanoTime() ? TimeThread.getNanoTime() :
+                             TimeThread.getTime()) >= getTimeLimitExpiration()))
     {
       setResultCode(ResultCode.TIME_LIMIT_EXCEEDED);
       appendErrorMessage(ERR_SEARCH_TIME_LIMIT_EXCEEDED.get(getTimeLimit()));
@@ -1623,8 +1625,8 @@
     else
     {
       // FIXME -- Factor in the user's effective time limit.
-      timeLimitExpiration =
-        getProcessingStartTime() + (1000L * timeLimit);
+      timeLimitExpiration = getProcessingStartTime() +
+          ((getUseNanoTime() ? 1000000000L : 1000L) * timeLimit);
     }
     setTimeLimitExpiration(timeLimitExpiration);
 

--
Gitblit v1.10.0