Skip to content
Browse files

begin the process of abstracting the benchmark code.

  • Loading branch information...
1 parent ae2dd51 commit 3265013573c79bb610eac3355f4c496a970a7d90 @chrisvest committed Jun 15, 2012
View
5 stormpot-benchmark/src/main/java/stormpot/benchmark/Benchmark.java
@@ -0,0 +1,5 @@
+package stormpot.benchmark;
+
+public abstract class Benchmark {
+ public abstract void run();
+}
View
12 stormpot-benchmark/src/main/java/stormpot/benchmark/Main.java
@@ -9,13 +9,21 @@ public static void main(String[] args) throws Exception {
* Remember to add pass-through properties to the pom.xml file,
* when adding properties here!
*/
+ Benchmark benchmark = null;
if (prop("help")) {
explain("throughput-single", "Single-threaded throughput");
- } else if (prop("throughput-single")) {
- Throughput.main(args);
+ return;
+ }
+ if (prop("throughput-single")) {
+ benchmark = new SingleThreadedThroughput();
+ }
+
+ if (benchmark != null) {
+ benchmark.run();
} else {
System.out.println("Run `mvn -Dhelp` for options.");
}
+ System.exit(0);
}
private static boolean prop(String prop) {
View
6 ...n/java/stormpot/benchmark/Throughput.java → ...t/benchmark/SingleThreadedThroughput.java
@@ -7,20 +7,18 @@
* in a given timeframe?
* @author cvh
*/
-public class Throughput {
+public class SingleThreadedThroughput extends Benchmark {
private static final Random rnd = new Random();
private static final int SIZE = 10;
private static final long TRIAL_TIME_MILLIS = 500L;
- public static void main(String[] args) {
+ public void run() {
Clock.start();
System.out.println("Stormpot Single-Threaded Throughput Benchmark");
try {
runBenchmark();
} catch (Exception e) {
e.printStackTrace();
- } finally {
- System.exit(0);
}
}

0 comments on commit 3265013

Please sign in to comment.
Something went wrong with that request. Please try again.