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

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1083557 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Doron Cohen 2011-03-20 20:12:39 +00:00
parent 2c64e2b268
commit 6d47d7377d
2 changed files with 15 additions and 1 deletions

View File

@ -2,6 +2,10 @@ Lucene Benchmark Contrib Change Log
The Benchmark contrib package contains code for benchmarking Lucene in a variety of ways. 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 03/10/2011
LUCENE-2961: Removed lib/xml-apis.jar, since JVM 1.5+ already contains the LUCENE-2961: Removed lib/xml-apis.jar, since JVM 1.5+ already contains the
JAXP 1.3 interface classes it provides. JAXP 1.3 interface classes it provides.

View File

@ -64,6 +64,9 @@ public class Benchmark {
} }
} }
/**
* Execute this benchmark
*/
public synchronized void execute() throws Exception { public synchronized void execute() throws Exception {
if (executed) { if (executed) {
throw new IllegalStateException("Benchmark was already executed"); throw new IllegalStateException("Benchmark was already executed");
@ -78,6 +81,14 @@ public class Benchmark {
* @param args benchmark config and algorithm files * @param args benchmark config and algorithm files
*/ */
public static void main(String[] args) { 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 // verify command line args
if (args.length < 1) { if (args.length < 1) {
System.err.println("Usage: java Benchmark <algorithm file>"); System.err.println("Usage: java Benchmark <algorithm file>");
@ -115,7 +126,6 @@ public class Benchmark {
System.out.println("####################"); System.out.println("####################");
System.out.println("### D O N E !!! ###"); System.out.println("### D O N E !!! ###");
System.out.println("####################"); System.out.println("####################");
} }
/** /**