You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2014/04/23 16:18:40 UTC

svn commit: r1589424 - in /lucene/dev/branches/branch_4x: ./ lucene/ lucene/core/ lucene/core/src/java/org/apache/lucene/index/IndexWriter.java

Author: mikemccand
Date: Wed Apr 23 14:18:39 2014
New Revision: 1589424

URL: http://svn.apache.org/r1589424
Log:
print commit time in msec to IW's infoStream

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/lucene/   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java

Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java?rev=1589424&r1=1589423&r2=1589424&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java Wed Apr 23 14:18:39 2014
@@ -281,6 +281,10 @@ public class IndexWriter implements Clos
   // to allow users to query an IndexWriter settings.
   private final LiveIndexWriterConfig config;
 
+  /** System.nanoTime() when commit started; used to write
+   *  an infoStream message about how long commit took. */
+  private long startCommitTime;
+
   DirectoryReader getReader() throws IOException {
     return getReader(true);
   }
@@ -2904,6 +2908,7 @@ public class IndexWriter implements Clos
   }
 
   private void prepareCommitInternal() throws IOException {
+    startCommitTime = System.nanoTime();
     synchronized(commitLock) {
       ensureOpen(false);
       if (infoStream.isEnabled("IW")) {
@@ -3129,6 +3134,10 @@ public class IndexWriter implements Clos
         notifyAll();
       }
 
+      if (infoStream.isEnabled("IW")) {
+        infoStream.message("IW", String.format(Locale.ROOT, "commit: took %.1f msec", (System.nanoTime()-startCommitTime)/1000000.0));
+      }
+      
     } else {
       if (infoStream.isEnabled("IW")) {
         infoStream.message("IW", "commit: pendingCommit == null; skip");