More JIT warmup.

pull/1/head
Brett Wooldridge 11 years ago
parent 5326e543e7
commit a70c02b2f4

@ -57,13 +57,12 @@ public class Benchmark1
System.out.println("\nMixedBench"); System.out.println("\nMixedBench");
System.out.println(" Warming up JIT"); System.out.println(" Warming up JIT");
benchmarks.startMixedBench(); benchmarks.startMixedBench(10000);
benchmarks.startMixedBench();
System.out.println(" MixedBench Final Timing Runs"); System.out.println(" MixedBench Final Timing Runs");
benchmarks.startMixedBench(); benchmarks.startMixedBench(1000);
benchmarks.startMixedBench(); benchmarks.startMixedBench(1000);
benchmarks.startMixedBench(); benchmarks.startMixedBench(1000);
benchmarks.startMixedBench(); benchmarks.startMixedBench(1000);
System.out.println("\nBoneBench"); System.out.println("\nBoneBench");
System.out.println(" Warming up JIT"); System.out.println(" Warming up JIT");
@ -119,7 +118,7 @@ public class Benchmark1
return ds; return ds;
} }
private void startMixedBench() private void startMixedBench(int iter)
{ {
CyclicBarrier barrier = new CyclicBarrier(THREADS); CyclicBarrier barrier = new CyclicBarrier(THREADS);
CountDownLatch latch = new CountDownLatch(THREADS); CountDownLatch latch = new CountDownLatch(THREADS);
@ -127,7 +126,7 @@ public class Benchmark1
Measurable[] runners = new Measurable[THREADS]; Measurable[] runners = new Measurable[THREADS];
for (int i = 0; i < THREADS; i++) for (int i = 0; i < THREADS; i++)
{ {
runners[i] = new MixedRunner(barrier, latch); runners[i] = new MixedRunner(barrier, latch, iter);
} }
runAndMeasure(runners, latch, "ms"); runAndMeasure(runners, latch, "ms");
@ -187,11 +186,13 @@ public class Benchmark1
private long start; private long start;
private long finish; private long finish;
private int counter; private int counter;
private final int iter;
public MixedRunner(CyclicBarrier barrier, CountDownLatch latch) public MixedRunner(CyclicBarrier barrier, CountDownLatch latch, int iter)
{ {
this.barrier = barrier; this.barrier = barrier;
this.latch = latch; this.latch = latch;
this.iter = iter;
} }
public void run() public void run()
@ -201,7 +202,7 @@ public class Benchmark1
barrier.await(); barrier.await();
start = System.nanoTime(); start = System.nanoTime();
for (int i = 0; i < 1000; i++) for (int i = 0; i < iter; i++)
{ {
Connection connection = ds.getConnection(); Connection connection = ds.getConnection();
for (int j = 0; j < 100; j++) for (int j = 0; j < 100; j++)

Loading…
Cancel
Save