Commit 0dec535a authored by Ivo Anjo's avatar Ivo Anjo

Added per-iteration warmup hooks

parent 11c5e8a5
......@@ -27,6 +27,8 @@ package javartm;
public abstract class AtomicRunnable<V> {
protected void beforeWarmup() { }
protected void afterWarmup() { }
protected void beforeWarmupIteration() { }
protected void afterWarmupIteration() { }
public abstract V run();
......
......@@ -45,7 +45,11 @@ public class Warmup {
/** Warms up the received runnable by calling it repeatedly until the VM JIT kicks in **/
public static void doWarmup(AtomicRunnable<?> r) {
r.beforeWarmup();
for (int i = 0; i < ITERATIONS; i++) r.run();
for (int i = 0; i < ITERATIONS; i++) {
r.beforeWarmupIteration();
r.run();
r.afterWarmupIteration();
}
r.afterWarmup();
try {
Thread.sleep(10);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment