mirror of https://github.com/apache/lucene.git
print commit time in msec to IW's infoStream
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1589423 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7847d3f899
commit
3c72219c98
|
@ -280,6 +280,10 @@ public class IndexWriter implements Closeable, TwoPhaseCommit{
|
||||||
// to allow users to query an IndexWriter settings.
|
// to allow users to query an IndexWriter settings.
|
||||||
private final LiveIndexWriterConfig config;
|
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 {
|
DirectoryReader getReader() throws IOException {
|
||||||
return getReader(true);
|
return getReader(true);
|
||||||
}
|
}
|
||||||
|
@ -2743,6 +2747,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit{
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prepareCommitInternal() throws IOException {
|
private void prepareCommitInternal() throws IOException {
|
||||||
|
startCommitTime = System.nanoTime();
|
||||||
synchronized(commitLock) {
|
synchronized(commitLock) {
|
||||||
ensureOpen(false);
|
ensureOpen(false);
|
||||||
if (infoStream.isEnabled("IW")) {
|
if (infoStream.isEnabled("IW")) {
|
||||||
|
@ -2968,6 +2973,10 @@ public class IndexWriter implements Closeable, TwoPhaseCommit{
|
||||||
notifyAll();
|
notifyAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (infoStream.isEnabled("IW")) {
|
||||||
|
infoStream.message("IW", String.format(Locale.ROOT, "commit: took %.1f msec", (System.nanoTime()-startCommitTime)/1000000.0));
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (infoStream.isEnabled("IW")) {
|
if (infoStream.isEnabled("IW")) {
|
||||||
infoStream.message("IW", "commit: pendingCommit == null; skip");
|
infoStream.message("IW", "commit: pendingCommit == null; skip");
|
||||||
|
|
Loading…
Reference in New Issue