Skip to content

Apache Lucene open-source search software

LUCENE-2963: Easier way to run benchmark, by calling Benmchmark.exec(alg-file) - port from 3x.

Doron Cohen6d47d7377dde
diff --git a/modules/benchmark/CHANGES.txt b/modules/benchmark/CHANGES.txt
index b7e8a7b43b9..0f2736fe4e3 100644
--- a/modules/benchmark/CHANGES.txt
+++ b/modules/benchmark/CHANGES.txt
@@ -2,6 +2,10 @@ Lucene Benchmark Contrib Change Log
The Benchmark contrib package contains code for benchmarking Lucene in a variety of ways.
+03/20/2011
+ LUCENE-2963: Easier way to run benchmark, by calling Benmchmark.exec(alg-file).
+ (Doron Cohen)
+
03/10/2011
LUCENE-2961: Removed lib/xml-apis.jar, since JVM 1.5+ already contains the
JAXP 1.3 interface classes it provides.
diff --git a/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/Benchmark.java b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/Benchmark.java
index 9b857436f4e..7ed8b82f6f6 100644
--- a/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/Benchmark.java
+++ b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/Benchmark.java
@@ -64,6 +64,9 @@ public class Benchmark {
}
}
+ /**
+ * Execute this benchmark
+ */
public synchronized void execute() throws Exception {
if (executed) {
throw new IllegalStateException("Benchmark was already executed");
@@ -78,6 +81,14 @@ public class Benchmark {
* @param args benchmark config and algorithm files
*/
public static void main(String[] args) {
+ exec(args);
+ }
+
+ /**
+ * Utility: execute benchmark from command line
+ * @param args single argument is expected: algorithm-file
+ */
+ public static void exec(String[] args) {
// verify command line args
if (args.length < 1) {
System.err.println("Usage: java Benchmark <algorithm file>");
@@ -115,7 +126,6 @@ public class Benchmark {
System.out.println("####################");
System.out.println("### D O N E !!! ###");
System.out.println("####################");
-
}
/**