mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

boli
01.54.2007 45fe4faa381a512a7c73b2cea5a67eab57f810d6
Added a server property to use nanoseconds instead of milliseconds in etime measurements.

Property name: org.opends.server.etime.nano
Accepted values: true | false
Default: false

Fix for issue 2499
2 files modified
44 ■■■■■ changed files
opends/src/server/org/opends/server/types/AbstractOperation.java 36 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/util/ServerConstants.java 8 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/types/AbstractOperation.java
@@ -30,6 +30,7 @@
import static org.opends.server.core.CoreConstants.*;
import static org.opends.server.util.ServerConstants.*;
import java.util.ArrayList;
import java.util.HashMap;
@@ -68,6 +69,23 @@
       new ArrayList<Control>(0);
  /**
   * Indicates whether to use nanoTime instead of
   * currentTimeMillis when setting processing start and stop times.
   */
  protected static boolean useNanoTime = false;
  static
  {
    if(System.getProperty(PROPERTY_ETIME_NANO) != null &&
         System.getProperty(PROPERTY_ETIME_NANO).
            equalsIgnoreCase("true"))
    {
      useNanoTime = true;
    }
  }
  /**
   * The client connection with which this operation is associated.
   */
  protected final ClientConnection clientConnection;
@@ -1027,7 +1045,14 @@
   */
  public final void setProcessingStartTime()
  {
    processingStartTime = System.currentTimeMillis();
    if(useNanoTime)
    {
      processingStartTime = System.nanoTime();
    }
    else
    {
      processingStartTime = System.currentTimeMillis();
    }
  }
@@ -1053,7 +1078,14 @@
   */
  public final void setProcessingStopTime()
  {
    this.processingStopTime = System.currentTimeMillis();
    if(useNanoTime)
    {
      this.processingStopTime = System.nanoTime();
    }
    else
    {
      this.processingStopTime = System.currentTimeMillis();
    }
  }
opends/src/server/org/opends/server/util/ServerConstants.java
@@ -2752,6 +2752,14 @@
       "org.opends.server.UseLastKnownGoodConfiguration";
  /**
   * The name of the system property that can be used to configure the
   * server to report etimes in nanoseconds instead of milliseconds.
   */
  public static final String PROPERTY_ETIME_NANO =
      "org.opends.server.etime.nano";
  /**
   * The column at which to wrap long lines of output in the command-line tools.