lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r728425 - in /lucene/java/trunk/contrib/benchmark: CHANGES.txt src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java src/test/org/apache/lucene/benchmark/byTask/tasks/CountingSearchTestTask.java
Date Sun, 21 Dec 2008 11:07:28 GMT
Author: mikemccand
Date: Sun Dec 21 03:07:28 2008
New Revision: 728425

URL: http://svn.apache.org/viewvc?rev=728425&view=rev
Log:
LUCENE-1495: fix time-based test to reduce change of false failure

Modified:
    lucene/java/trunk/contrib/benchmark/CHANGES.txt
    lucene/java/trunk/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java
    lucene/java/trunk/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/CountingSearchTestTask.java

Modified: lucene/java/trunk/contrib/benchmark/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/benchmark/CHANGES.txt?rev=728425&r1=728424&r2=728425&view=diff
==============================================================================
--- lucene/java/trunk/contrib/benchmark/CHANGES.txt (original)
+++ lucene/java/trunk/contrib/benchmark/CHANGES.txt Sun Dec 21 03:07:28 2008
@@ -3,6 +3,9 @@
 The Benchmark contrib package contains code for benchmarking Lucene in a variety of ways.
 
 $Id:$
+12/20/08
+  LUCENE-1495: Allow task sequence to run for specfied number of seconds by adding ": 2.7s"
(for example).
+
 12/16/08
   LUCENE-1493: Stop using deprecated Hits API for searching; add new
   param search.num.hits to set top N docs to collect.

Modified: lucene/java/trunk/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java?rev=728425&r1=728424&r2=728425&view=diff
==============================================================================
--- lucene/java/trunk/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java
(original)
+++ lucene/java/trunk/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java
Sun Dec 21 03:07:28 2008
@@ -112,13 +112,12 @@
         "{ CountingSearchTest } : 1.5s",
         "CloseReader",
     };
-    
-    long t0 = System.currentTimeMillis();
+
+    CountingSearchTestTask.numSearches = 0;
     Benchmark benchmark = execBenchmark(algLines);
-    long t1 = System.currentTimeMillis();
     assertTrue(CountingSearchTestTask.numSearches > 0);
-    long elapsed = t1-t0;
-    assertTrue(elapsed > 1500 && elapsed < 2000);
+    long elapsed = CountingSearchTestTask.lastMillis - CountingSearchTestTask.startMillis;
+    assertTrue("elapsed time was " + elapsed + " msec", elapsed < 2000);
   }
 
   public void testHighlighting() throws Exception {

Modified: lucene/java/trunk/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/CountingSearchTestTask.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/CountingSearchTestTask.java?rev=728425&r1=728424&r2=728425&view=diff
==============================================================================
--- lucene/java/trunk/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/CountingSearchTestTask.java
(original)
+++ lucene/java/trunk/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/CountingSearchTestTask.java
Sun Dec 21 03:07:28 2008
@@ -25,6 +25,8 @@
 public class CountingSearchTestTask extends SearchTask {
 
   public static int numSearches = 0; 
+  public static long startMillis;
+  public static long lastMillis;
 
   public CountingSearchTestTask(PerfRunData runData) {
     super(runData);
@@ -37,7 +39,13 @@
   }
 
   private static synchronized void incrNumSearches() {
+    lastMillis = System.currentTimeMillis();
+    if (0 == numSearches)
+      startMillis = lastMillis;
     numSearches++;
   }
 
+  public long getElapsedMillis() {
+    return lastMillis - startMillis;
+  }
 }



Mime
View raw message