changeset 118:c859389d08d6

Rename Loop -> InfraControl.
author shade
date Sat, 17 Aug 2013 14:07:36 +0400
parents 65b09f85aee3
children f321a6407e5a
files jmh-core-it/src/test/java/org/openjdk/jmh/it/bulkwarmup/WarmupMode6_Test.java jmh-core/src/main/java/org/openjdk/jmh/annotations/OperationsPerInvocation.java jmh-core/src/main/java/org/openjdk/jmh/logic/InfraControl.java jmh-core/src/main/java/org/openjdk/jmh/logic/Loop.java jmh-core/src/main/java/org/openjdk/jmh/processor/internal/GenerateMicroBenchmarkProcessor.java jmh-core/src/main/java/org/openjdk/jmh/runner/LoopMicroBenchmarkHandler.java jmh-core/src/main/java/org/openjdk/jmh/runner/MicroBenchmarkHandlers.java jmh-core/src/test/java/org/openjdk/jmh/runner/options/TestOptions.java
diffstat 8 files changed, 267 insertions(+), 297 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core-it/src/test/java/org/openjdk/jmh/it/bulkwarmup/WarmupMode6_Test.java	Sat Aug 17 13:21:15 2013 +0400
+++ b/jmh-core-it/src/test/java/org/openjdk/jmh/it/bulkwarmup/WarmupMode6_Test.java	Sat Aug 17 14:07:36 2013 +0400
@@ -29,19 +29,14 @@
 import org.openjdk.jmh.Main;
 import org.openjdk.jmh.annotations.GenerateMicroBenchmark;
 import org.openjdk.jmh.annotations.Level;
-import org.openjdk.jmh.annotations.MicroBenchmark;
 import org.openjdk.jmh.annotations.Scope;
 import org.openjdk.jmh.annotations.Setup;
 import org.openjdk.jmh.annotations.State;
 import org.openjdk.jmh.it.Fixtures;
 import org.openjdk.jmh.logic.Control;
-import org.openjdk.jmh.logic.Loop;
-import org.openjdk.jmh.logic.results.AverageTimePerOp;
-import org.openjdk.jmh.logic.results.Result;
 
 import java.util.Queue;
 import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.TimeUnit;
 
 import static junit.framework.Assert.assertEquals;
 
--- a/jmh-core/src/main/java/org/openjdk/jmh/annotations/OperationsPerInvocation.java	Sat Aug 17 13:21:15 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/annotations/OperationsPerInvocation.java	Sat Aug 17 14:07:36 2013 +0400
@@ -33,8 +33,6 @@
 /**
  * Annotation specifies how much to increase the operations count for each invocation of the test-method.
  * <p>
- * Example that show how each call to {@code convert(char)} is counted as
- * an operation instead of each call to {@code testCharConversion()}.
  * <blockquote><pre>
  * &#64;GenerateMicroBenchmark
  * &#64;OperationsPerInvocation(10)
@@ -43,20 +41,6 @@
  *          dummy = convert(i);
  *      }
  * }
- *
- * ==>
- *
- * &#64;MicroBenchmark()
- * public Result testCharConversion(Loop loop) throws Exception {
- *      long operations = 0;
- *      loop.start();
- *      while(!loop.done()) {
- *          testCharConversion();
- *          operations += 10;
- *      }
- *      loop.end();
- *      return new OpsPerTimeUnit(operations, loop.getTime(), TimeUnit.MILLISECONDS);
- * }
  * </pre></blockquote></p>
  */
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jmh-core/src/main/java/org/openjdk/jmh/logic/InfraControl.java	Sat Aug 17 14:07:36 2013 +0400
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jmh.logic;
+
+import org.openjdk.jmh.runner.parameters.TimeValue;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * The InfraControl logic class.
+ * This is the rendezvous class for benchmark handler and JMH.
+ *
+ * @author staffan.friberg@oracle.com, anders.astrand@oracle.com, aleksey.shipilev@oracle.com
+ */
+public class InfraControl extends InfraControlL4 {
+
+    /** Timers */
+    private static final ScheduledExecutorService timers = Executors.newScheduledThreadPool(1, new ThreadFactory() {
+        @Override
+        public Thread newThread(Runnable r) {
+            Thread t = new Thread(r);
+            t.setPriority(Thread.MAX_PRIORITY);
+            t.setDaemon(true);
+            t.setName("LoopTimer");
+            return t;
+        }
+    });
+
+    public InfraControl(int threads, boolean syncIterations, TimeValue loopTime, CountDownLatch preSetup, CountDownLatch preTearDown, boolean lastIteration, TimeUnit timeUnit) {
+        super(threads, syncIterations, loopTime, preSetup, preTearDown, lastIteration, timeUnit);
+    }
+
+    public void enable() {
+        assert !isDone;
+        isDone = false;
+
+        timers.schedule(new Runnable() {
+            @Override
+            public void run() {
+                isDone = true;
+            }
+        }, duration, TimeUnit.NANOSECONDS);
+    }
+
+    /**
+     * returns requested loop duration in milliseconds.
+     * the primary purpose of the method - integration tests.
+     * @return
+     */
+    public long getDuration() {
+        return getDuration(TimeUnit.MILLISECONDS);
+    }
+
+    /**
+     * returns requested loop duration in the requested unit.
+     * the primary purpose of the method - integration tests.
+     * @param unit
+     * @return
+     */
+    public long getDuration(TimeUnit unit) {
+        return unit.convert(duration, TimeUnit.NANOSECONDS);
+    }
+
+    public void preSetup() {
+        try {
+            preSetup.countDown();
+            preSetup.await();
+        } catch (InterruptedException e) {
+            throw new IllegalStateException(e);
+        }
+    }
+
+    public void preTearDown() {
+        try {
+            preTearDown.countDown();
+            preTearDown.await();
+        } catch (InterruptedException e) {
+            throw new IllegalStateException(e);
+        }
+    }
+
+    public void preSetupForce() {
+        preSetup.countDown();
+    }
+
+    public void preTearDownForce() {
+        preTearDown.countDown();
+    }
+
+    public boolean isLastIteration() {
+        return lastIteration;
+    }
+}
+
+class InfraControl_L1 {
+    public int p01, p02, p03, p04, p05, p06, p07, p08;
+    public int p11, p12, p13, p14, p15, p16, p17, p18;
+    public int p21, p22, p23, p24, p25, p26, p27, p28;
+    public int p31, p32, p33, p34, p35, p36, p37, p38;
+}
+
+/**
+ * @see BlackHole for rationale
+ */
+class InfraControlL2 extends InfraControl_L1 {
+    /* Flag for if we are done or not.
+     * This is specifically the public field, so to spare one virtual call.
+     */
+    public volatile boolean isDone;
+
+    /** How long we should loop */
+    public final long duration;
+
+    public final CountDownLatch preSetup;
+    public final CountDownLatch preTearDown;
+    public final boolean lastIteration;
+    public final TimeUnit timeUnit;
+    public final int threads;
+    public final boolean syncIterations;
+
+    public final AtomicInteger warmupVisited, warmdownVisited;
+    public volatile boolean warmupShouldWait, warmdownShouldWait;
+
+    public InfraControlL2(int threads, boolean syncIterations, TimeValue loopTime, CountDownLatch preSetup, CountDownLatch preTearDown, boolean lastIteration, TimeUnit timeUnit) {
+        this.threads = threads;
+        this.syncIterations = syncIterations;
+        this.warmupVisited = new AtomicInteger();
+        this.warmdownVisited = new AtomicInteger();
+
+        warmupShouldWait = syncIterations;
+        warmdownShouldWait = syncIterations;
+        this.preSetup = preSetup;
+        this.preTearDown = preTearDown;
+        this.duration = loopTime.convertTo(TimeUnit.NANOSECONDS);
+        this.lastIteration = lastIteration;
+        this.timeUnit = timeUnit;
+    }
+
+    public void announceWarmupReady() {
+        if (!syncIterations) return;
+        int v = warmupVisited.incrementAndGet();
+        if (v == threads) {
+            warmupShouldWait = false;
+        }
+
+        if (v > threads) {
+            throw new IllegalStateException("More threads than expected");
+        }
+    }
+
+    public void announceWarmdownReady() {
+        if (!syncIterations) return;
+        int v = warmdownVisited.incrementAndGet();
+        if (v == threads) {
+            warmdownShouldWait = false;
+        }
+
+        if (v > threads) {
+            throw new IllegalStateException("More threads than expected");
+        }
+    }
+
+}
+
+class InfraControlL3 extends InfraControlL2 {
+    public int e01, e02, e03, e04, e05, e06, e07, e08;
+    public int e11, e12, e13, e14, e15, e16, e17, e18;
+    public int e21, e22, e23, e24, e25, e26, e27, e28;
+    public int e31, e32, e33, e34, e35, e36, e37, e38;
+
+    public InfraControlL3(int threads, boolean syncIterations, TimeValue loopTime, CountDownLatch preSetup, CountDownLatch preTearDown, boolean lastIteration, TimeUnit timeUnit) {
+        super(threads, syncIterations, loopTime, preSetup, preTearDown, lastIteration, timeUnit);
+    }
+}
+
+class InfraControlL4 extends InfraControlL3 {
+    public int marker;
+
+    public InfraControlL4(int threads, boolean syncIterations, TimeValue loopTime, CountDownLatch preSetup, CountDownLatch preTearDown, boolean lastIteration, TimeUnit timeUnit) {
+        super(threads, syncIterations, loopTime, preSetup, preTearDown, lastIteration, timeUnit);
+    }
+}
+
--- a/jmh-core/src/main/java/org/openjdk/jmh/logic/Loop.java	Sat Aug 17 13:21:15 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,209 +0,0 @@
-/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package org.openjdk.jmh.logic;
-
-import org.openjdk.jmh.runner.parameters.TimeValue;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * The Loop logic class. Controls if we should iterate another lap in the benchmark loop via calls to done();
- *
- * @author staffan.friberg@oracle.com, anders.astrand@oracle.com, aleksey.shipilev@oracle.com
- */
-public class Loop extends LoopL4 {
-
-    /** Timers */
-    private static final ScheduledExecutorService timers = Executors.newScheduledThreadPool(1, new ThreadFactory() {
-        @Override
-        public Thread newThread(Runnable r) {
-            Thread t = new Thread(r);
-            t.setPriority(Thread.MAX_PRIORITY);
-            t.setDaemon(true);
-            t.setName("LoopTimer");
-            return t;
-        }
-    });
-
-    public Loop(int threads, boolean syncIterations, TimeValue loopTime, CountDownLatch preSetup, CountDownLatch preTearDown, boolean lastIteration, TimeUnit timeUnit) {
-        super(threads, syncIterations, loopTime, preSetup, preTearDown, lastIteration, timeUnit);
-    }
-
-    public void enable() {
-        assert !isDone;
-        isDone = false;
-
-        timers.schedule(new Runnable() {
-            @Override
-            public void run() {
-                isDone = true;
-            }
-        }, duration, TimeUnit.NANOSECONDS);
-    }
-
-    /**
-     * returns requested loop duration in milliseconds.
-     * the primary purpose of the method - integration tests.
-     * @return
-     */
-    public long getDuration() {
-        return getDuration(TimeUnit.MILLISECONDS);
-    }
-
-    /**
-     * returns requested loop duration in the requested unit.
-     * the primary purpose of the method - integration tests.
-     * @param unit
-     * @return
-     */
-    public long getDuration(TimeUnit unit) {
-        return unit.convert(duration, TimeUnit.NANOSECONDS);
-    }
-
-    public void preSetup() {
-        try {
-            preSetup.countDown();
-            preSetup.await();
-        } catch (InterruptedException e) {
-            throw new IllegalStateException(e);
-        }
-    }
-
-    public void preTearDown() {
-        try {
-            preTearDown.countDown();
-            preTearDown.await();
-        } catch (InterruptedException e) {
-            throw new IllegalStateException(e);
-        }
-    }
-
-    public void preSetupForce() {
-        preSetup.countDown();
-    }
-
-    public void preTearDownForce() {
-        preTearDown.countDown();
-    }
-
-    public boolean isLastIteration() {
-        return lastIteration;
-    }
-}
-
-class LoopL1 {
-    public int p01, p02, p03, p04, p05, p06, p07, p08;
-    public int p11, p12, p13, p14, p15, p16, p17, p18;
-    public int p21, p22, p23, p24, p25, p26, p27, p28;
-    public int p31, p32, p33, p34, p35, p36, p37, p38;
-}
-
-/**
- * @see BlackHole for rationale
- */
-class LoopL2 extends LoopL1 {
-    /* Flag for if we are done or not.
-     * This is specifically the public field, so to spare one virtual call.
-     */
-    public volatile boolean isDone;
-
-    /** How long we should loop */
-    public final long duration;
-
-    public final CountDownLatch preSetup;
-    public final CountDownLatch preTearDown;
-    public final boolean lastIteration;
-    public final TimeUnit timeUnit;
-    public final int threads;
-    public final boolean syncIterations;
-
-    public final AtomicInteger warmupVisited, warmdownVisited;
-    public volatile boolean warmupShouldWait, warmdownShouldWait;
-
-    public LoopL2(int threads, boolean syncIterations, TimeValue loopTime, CountDownLatch preSetup, CountDownLatch preTearDown, boolean lastIteration, TimeUnit timeUnit) {
-        this.threads = threads;
-        this.syncIterations = syncIterations;
-        this.warmupVisited = new AtomicInteger();
-        this.warmdownVisited = new AtomicInteger();
-
-        warmupShouldWait = syncIterations;
-        warmdownShouldWait = syncIterations;
-        this.preSetup = preSetup;
-        this.preTearDown = preTearDown;
-        this.duration = loopTime.convertTo(TimeUnit.NANOSECONDS);
-        this.lastIteration = lastIteration;
-        this.timeUnit = timeUnit;
-    }
-
-    public void announceWarmupReady() {
-        if (!syncIterations) return;
-        int v = warmupVisited.incrementAndGet();
-        if (v == threads) {
-            warmupShouldWait = false;
-        }
-
-        if (v > threads) {
-            throw new IllegalStateException("More threads than expected");
-        }
-    }
-
-    public void announceWarmdownReady() {
-        if (!syncIterations) return;
-        int v = warmdownVisited.incrementAndGet();
-        if (v == threads) {
-            warmdownShouldWait = false;
-        }
-
-        if (v > threads) {
-            throw new IllegalStateException("More threads than expected");
-        }
-    }
-
-}
-
-class LoopL3 extends LoopL2 {
-    public int e01, e02, e03, e04, e05, e06, e07, e08;
-    public int e11, e12, e13, e14, e15, e16, e17, e18;
-    public int e21, e22, e23, e24, e25, e26, e27, e28;
-    public int e31, e32, e33, e34, e35, e36, e37, e38;
-
-    public LoopL3(int threads, boolean syncIterations, TimeValue loopTime, CountDownLatch preSetup, CountDownLatch preTearDown, boolean lastIteration, TimeUnit timeUnit) {
-        super(threads, syncIterations, loopTime, preSetup, preTearDown, lastIteration, timeUnit);
-    }
-}
-
-class LoopL4 extends LoopL3 {
-    public int marker;
-
-    public LoopL4(int threads, boolean syncIterations, TimeValue loopTime, CountDownLatch preSetup, CountDownLatch preTearDown, boolean lastIteration, TimeUnit timeUnit) {
-        super(threads, syncIterations, loopTime, preSetup, preTearDown, lastIteration, timeUnit);
-    }
-}
-
--- a/jmh-core/src/main/java/org/openjdk/jmh/processor/internal/GenerateMicroBenchmarkProcessor.java	Sat Aug 17 13:21:15 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/processor/internal/GenerateMicroBenchmarkProcessor.java	Sat Aug 17 14:07:36 2013 +0400
@@ -38,7 +38,7 @@
 import org.openjdk.jmh.annotations.Threads;
 import org.openjdk.jmh.annotations.Warmup;
 import org.openjdk.jmh.logic.BlackHole;
-import org.openjdk.jmh.logic.Loop;
+import org.openjdk.jmh.logic.InfraControl;
 import org.openjdk.jmh.logic.results.AverageTimePerOp;
 import org.openjdk.jmh.logic.results.OpsPerTimeUnit;
 import org.openjdk.jmh.logic.results.RawResultPair;
@@ -420,7 +420,7 @@
         writer.println("import " + TimeUnit.class.getName() + ';');
         writer.println("import " + Generated.class.getName() + ';');
         writer.println();
-        writer.println("import " + Loop.class.getName() + ';');
+        writer.println("import " + InfraControl.class.getName() + ';');
         writer.println("import " + BlackHole.class.getName() + ';');
         writer.println("import " + Result.class.getName() + ';');
         writer.println("import " + OpsPerTimeUnit.class.getName() + ';');
@@ -678,7 +678,7 @@
     }
 
     private void generateOpsPerTimeUnit(PrintWriter writer, Mode benchmarkKind, MethodGroup methodGroup, long opsPerInv, TimeUnit timeUnit, StateObjectHandler states) {
-        writer.println(ident(1) + "public Result " + methodGroup.getName() + "_" + benchmarkKind + "(Loop loop) throws Throwable { ");
+        writer.println(ident(1) + "public Result " + methodGroup.getName() + "_" + benchmarkKind + "(InfraControl control) throws Throwable { ");
         writer.println();
 
         methodProlog(writer, methodGroup);
@@ -698,10 +698,10 @@
             iterationProlog(writer, 3, method, states);
 
             // synchronize iterations prolog: announce ready
-            writer.println(ident(3) + "loop.announceWarmupReady();");
+            writer.println(ident(3) + "control.announceWarmupReady();");
 
             // synchronize iterations prolog: catchup loop
-            writer.println(ident(3) + "while (loop.warmupShouldWait) {");
+            writer.println(ident(3) + "while (control.warmupShouldWait) {");
 
             invocationProlog(writer, 4, method, states, false);
             writer.println(ident(4) + emitCall(method, states) + ';');
@@ -713,11 +713,11 @@
             // control objects get a special treatment
             for (StateObject so : states.getControls()) {
                 writer.println(ident(3) + so.localIdentifier + ".startMeasurement = true;");
-                writer.println(ident(3) + so.localIdentifier + ".iterationTime = loop.getDuration();");
+                writer.println(ident(3) + so.localIdentifier + ".iterationTime = control.getDuration();");
             }
 
             // measurement loop call
-            writer.println(ident(3) + "RawResultPair res = " + method.getSimpleName() + "_" + benchmarkKind + "_measurementLoop(loop, " + states.getImplicit("bench").toLocal() + ", " + states.getImplicit("blackhole").toLocal() + prefix(states.getArgList(method)) + ");");
+            writer.println(ident(3) + "RawResultPair res = " + method.getSimpleName() + "_" + benchmarkKind + "_measurementLoop(control, " + states.getImplicit("bench").toLocal() + ", " + states.getImplicit("blackhole").toLocal() + prefix(states.getArgList(method)) + ");");
 
             // control objects get a special treatment
             for (StateObject so : states.getControls()) {
@@ -725,10 +725,10 @@
             }
 
             // synchronize iterations epilog: announce ready
-            writer.println(ident(3) + "loop.announceWarmdownReady();");
+            writer.println(ident(3) + "control.announceWarmdownReady();");
 
             // synchronize iterations epilog: catchup loop
-            writer.println(ident(3) + "while (loop.warmdownShouldWait) {");
+            writer.println(ident(3) + "while (control.warmdownShouldWait) {");
 
             invocationProlog(writer, 4, method, states, false);
             writer.println(ident(4) + emitCall(method, states) + ';');
@@ -739,7 +739,7 @@
             // iteration prolog
             iterationEpilog(writer, 3, method, states);
 
-            writer.println(ident(3) + "return new OpsPerTimeUnit(\"" + method.getSimpleName() + "\", res.operations, res.time, (loop.timeUnit != null) ? loop.timeUnit : TimeUnit." + timeUnit + ");");
+            writer.println(ident(3) + "return new OpsPerTimeUnit(\"" + method.getSimpleName() + "\", res.operations, res.time, (control.timeUnit != null) ? control.timeUnit : TimeUnit." + timeUnit + ");");
             writer.println(ident(2) + "} else");
         }
         writer.println(ident(3) + "throw new IllegalStateException(\"Harness failed to distribute threads among groups properly\");");
@@ -749,7 +749,7 @@
 
         // measurement loop bodies
         for (Element method : methodGroup.methods()) {
-            writer.println("    public " + (methodGroup.isStrictFP() ? "strictfp" : "") + " RawResultPair " + method.getSimpleName() + "_" + benchmarkKind + "_measurementLoop(Loop loop, " + states.getImplicit("bench").toTypeDef() + ", " + states.getImplicit("blackhole").toTypeDef() + prefix(states.getTypeArgList(method)) + ") throws Throwable {");
+            writer.println("    public " + (methodGroup.isStrictFP() ? "strictfp" : "") + " RawResultPair " + method.getSimpleName() + "_" + benchmarkKind + "_measurementLoop(InfraControl control, " + states.getImplicit("bench").toTypeDef() + ", " + states.getImplicit("blackhole").toTypeDef() + prefix(states.getTypeArgList(method)) + ") throws Throwable {");
             writer.println("        long operations = 0;");
             writer.println("        long realTime = 0;");
             writer.println("        long startTime = System.nanoTime();");
@@ -760,7 +760,7 @@
             invocationEpilog(writer, 3, method, states, true);
 
             writer.println("            operations++;");
-            writer.println("        } while(!loop.isDone);");
+            writer.println("        } while(!control.isDone);");
             writer.println("        long stopTime = System.nanoTime();");
             writer.println("        return new RawResultPair(operations * " + opsPerInv + "L,  (realTime > 0) ? realTime : (stopTime - startTime));");
             writer.println("    }");
@@ -769,7 +769,7 @@
     }
 
     private void generateAverageTime(PrintWriter writer, Mode benchmarkKind, MethodGroup methodGroup, long opsPerInv, TimeUnit timeUnit, StateObjectHandler states) {
-        writer.println(ident(1) + "public Result " + methodGroup.getName() + "_" + benchmarkKind + "(Loop loop) throws Throwable { ");
+        writer.println(ident(1) + "public Result " + methodGroup.getName() + "_" + benchmarkKind + "(InfraControl control) throws Throwable { ");
 
         methodProlog(writer, methodGroup);
 
@@ -787,10 +787,10 @@
             iterationProlog(writer, 3, method, states);
 
             // synchronize iterations prolog: announce ready
-            writer.println(ident(3) + "loop.announceWarmupReady();");
+            writer.println(ident(3) + "control.announceWarmupReady();");
 
             // synchronize iterations prolog: catchup loop
-            writer.println(ident(3) + "while (loop.warmupShouldWait) {");
+            writer.println(ident(3) + "while (control.warmupShouldWait) {");
 
             invocationProlog(writer, 4, method, states, false);
             writer.println(ident(4) + emitCall(method, states) + ';');
@@ -802,11 +802,11 @@
             // control objects get a special treatment
             for (StateObject so : states.getControls()) {
                 writer.println(ident(3) + so.localIdentifier + ".startMeasurement = true;");
-                writer.println(ident(3) + so.localIdentifier + ".iterationTime = loop.getDuration();");
+                writer.println(ident(3) + so.localIdentifier + ".iterationTime = control.getDuration();");
             }
 
             // measurement loop call
-            writer.println(ident(3) + "RawResultPair res = " + method.getSimpleName() + "_" + benchmarkKind + "_measurementLoop(loop, " + states.getImplicit("bench").toLocal() + ", " + states.getImplicit("blackhole").toLocal() + prefix(states.getArgList(method)) + ");");
+            writer.println(ident(3) + "RawResultPair res = " + method.getSimpleName() + "_" + benchmarkKind + "_measurementLoop(control, " + states.getImplicit("bench").toLocal() + ", " + states.getImplicit("blackhole").toLocal() + prefix(states.getArgList(method)) + ");");
 
             // control objects get a special treatment
             for (StateObject so : states.getControls()) {
@@ -814,10 +814,10 @@
             }
 
             // synchronize iterations epilog: announce ready
-            writer.println(ident(3) + "loop.announceWarmdownReady();");
+            writer.println(ident(3) + "control.announceWarmdownReady();");
 
             // synchronize iterations epilog: catchup loop
-            writer.println(ident(3) + "while (loop.warmdownShouldWait) {");
+            writer.println(ident(3) + "while (control.warmdownShouldWait) {");
 
             invocationProlog(writer, 4, method, states, false);
             writer.println(ident(4) + emitCall(method, states) + ';');
@@ -827,7 +827,7 @@
 
             iterationEpilog(writer, 3, method, states);
 
-            writer.println(ident(3) + "return new AverageTimePerOp(\"" + method.getSimpleName() + "\", res.operations, res.time, (loop.timeUnit != null) ? loop.timeUnit : TimeUnit." + timeUnit + ");");
+            writer.println(ident(3) + "return new AverageTimePerOp(\"" + method.getSimpleName() + "\", res.operations, res.time, (control.timeUnit != null) ? control.timeUnit : TimeUnit." + timeUnit + ");");
             writer.println(ident(2) + "} else");
         }
         writer.println(ident(3) + "throw new IllegalStateException(\"Harness failed to distribute threads among groups properly\");");
@@ -837,7 +837,7 @@
 
         // measurement loop bodies
         for (Element method : methodGroup.methods()) {
-            writer.println("    public " + (methodGroup.isStrictFP() ? "strictfp" : "") +  " RawResultPair " + method.getSimpleName() + "_" + benchmarkKind + "_measurementLoop(Loop loop, " + states.getImplicit("bench").toTypeDef() + ", " + states.getImplicit("blackhole").toTypeDef() + prefix(states.getTypeArgList(method)) + ") throws Throwable {");
+            writer.println("    public " + (methodGroup.isStrictFP() ? "strictfp" : "") +  " RawResultPair " + method.getSimpleName() + "_" + benchmarkKind + "_measurementLoop(InfraControl control, " + states.getImplicit("bench").toTypeDef() + ", " + states.getImplicit("blackhole").toTypeDef() + prefix(states.getTypeArgList(method)) + ") throws Throwable {");
             writer.println("        long operations = 0;");
             writer.println("        long realTime = 0;");
             writer.println("        long start = System.nanoTime();");
@@ -848,7 +848,7 @@
             invocationEpilog(writer, 3, method, states, true);
 
             writer.println("            operations++;");
-            writer.println("        } while(!loop.isDone);");
+            writer.println("        } while(!control.isDone);");
             writer.println("        long end = System.nanoTime();");
             writer.println("        return new RawResultPair(operations * " + opsPerInv + "L,  (realTime > 0) ? realTime : (end - start));");
             writer.println("    }");
@@ -877,7 +877,7 @@
     }
 
     private void generateTimeDistribution(PrintWriter writer, Mode benchmarkKind, MethodGroup methodGroup, TimeUnit timeUnit, StateObjectHandler states) {
-        writer.println(ident(1) + "public Result " + methodGroup.getName() + "_" + benchmarkKind + "(Loop loop) throws Throwable { ");
+        writer.println(ident(1) + "public Result " + methodGroup.getName() + "_" + benchmarkKind + "(InfraControl control) throws Throwable { ");
         writer.println();
 
         methodProlog(writer, methodGroup);
@@ -895,10 +895,10 @@
             iterationProlog(writer, 3, method, states);
 
             // synchronize iterations prolog: announce ready
-            writer.println(ident(3) + "loop.announceWarmupReady();");
+            writer.println(ident(3) + "control.announceWarmupReady();");
 
             // synchronize iterations prolog: catchup loop
-            writer.println(ident(3) + "while (loop.warmupShouldWait) {");
+            writer.println(ident(3) + "while (control.warmupShouldWait) {");
 
             invocationProlog(writer, 4, method, states, false);
             writer.println(ident(4) + emitCall(method, states) + ';');
@@ -910,11 +910,11 @@
             // control objects get a special treatment
             for (StateObject so : states.getControls()) {
                 writer.println(ident(3) + so.localIdentifier + ".startMeasurement = true;");
-                writer.println(ident(3) + so.localIdentifier + ".iterationTime = loop.getDuration();");
+                writer.println(ident(3) + so.localIdentifier + ".iterationTime = control.getDuration();");
             }
 
             // measurement loop call
-            writer.println(ident(3) + "Result res = " + method.getSimpleName() + "_" + benchmarkKind + "_measurementLoop(loop, " + states.getImplicit("bench").toLocal() + ", " + states.getImplicit("blackhole").toLocal() + prefix(states.getArgList(method)) + ");");
+            writer.println(ident(3) + "Result res = " + method.getSimpleName() + "_" + benchmarkKind + "_measurementLoop(control, " + states.getImplicit("bench").toLocal() + ", " + states.getImplicit("blackhole").toLocal() + prefix(states.getArgList(method)) + ");");
 
             // control objects get a special treatment
             for (StateObject so : states.getControls()) {
@@ -922,10 +922,10 @@
             }
 
             // synchronize iterations epilog: announce ready
-            writer.println(ident(3) + "loop.announceWarmdownReady();");
+            writer.println(ident(3) + "control.announceWarmdownReady();");
 
             // synchronize iterations epilog: catchup loop
-            writer.println(ident(3) + "while (loop.warmdownShouldWait) {");
+            writer.println(ident(3) + "while (control.warmdownShouldWait) {");
 
             invocationProlog(writer, 4, method, states, false);
             writer.println(ident(4) + emitCall(method, states) + ';');
@@ -945,7 +945,7 @@
 
         // measurement loop bodies
         for (Element method : methodGroup.methods()) {
-            writer.println("    public " + (methodGroup.isStrictFP() ? "strictfp" : "") + " Result " + method.getSimpleName() + "_" + benchmarkKind + "_measurementLoop(Loop loop, " + states.getImplicit("bench").toTypeDef() + ", " + states.getImplicit("blackhole").toTypeDef() + prefix(states.getTypeArgList(method)) + ") throws Throwable {");
+            writer.println("    public " + (methodGroup.isStrictFP() ? "strictfp" : "") + " Result " + method.getSimpleName() + "_" + benchmarkKind + "_measurementLoop(InfraControl control, " + states.getImplicit("bench").toTypeDef() + ", " + states.getImplicit("blackhole").toTypeDef() + prefix(states.getTypeArgList(method)) + ") throws Throwable {");
             writer.println("        SampleBuffer buffer = new SampleBuffer();");
             writer.println("        long realTime = 0;");
             writer.println("        long rnd = System.nanoTime();");
@@ -972,15 +972,15 @@
 
             invocationEpilog(writer, 4, method, states, true);
 
-            writer.println("        } while(!loop.isDone);");
-            writer.println("        return new SampleTimePerOp(\"" + method.getSimpleName() + "\", buffer, (loop.timeUnit != null) ? loop.timeUnit : TimeUnit." + timeUnit + ");");
+            writer.println("        } while(!control.isDone);");
+            writer.println("        return new SampleTimePerOp(\"" + method.getSimpleName() + "\", buffer, (control.timeUnit != null) ? control.timeUnit : TimeUnit." + timeUnit + ");");
             writer.println("    }");
             writer.println();
         }
     }
 
     private void generateSingleShot(PrintWriter writer, Mode benchmarkKind, MethodGroup methodGroup, TimeUnit timeUnit, StateObjectHandler states) {
-        writer.println(ident(1) + "public Result " + methodGroup.getName() + "_" + benchmarkKind + "(Loop loop) throws Throwable { ");
+        writer.println(ident(1) + "public Result " + methodGroup.getName() + "_" + benchmarkKind + "(InfraControl control) throws Throwable { ");
 
         methodProlog(writer, methodGroup);
 
@@ -1009,7 +1009,7 @@
 
             iterationEpilog(writer, 3, method, states);
 
-            writer.println(ident(3) + "return new SingleShotTime(\"" + method.getSimpleName() + "\", (realTime > 0) ? realTime : (time2 - time1), (loop.timeUnit != null) ? loop.timeUnit : TimeUnit." + timeUnit + ");");
+            writer.println(ident(3) + "return new SingleShotTime(\"" + method.getSimpleName() + "\", (realTime > 0) ? realTime : (time2 - time1), (control.timeUnit != null) ? control.timeUnit : TimeUnit." + timeUnit + ");");
             writer.println(ident(2) + "} else");
         }
         writer.println(ident(3) + "throw new IllegalStateException(\"Harness failed to distribute threads among groups properly\");");
@@ -1043,19 +1043,19 @@
         for (String s : states.getStateGetters(method)) writer.println(ident(prefix) + s);
         writer.println();
 
-        writer.println(ident(prefix) + "loop.preSetup();");
+        writer.println(ident(prefix) + "control.preSetup();");
 
         for (String s : states.getIterationSetups(method)) writer.println(ident(prefix) + s);
         writer.println();
     }
 
     private void iterationEpilog(PrintWriter writer, int prefix, Element method, StateObjectHandler states) {
-        writer.println(ident(prefix) + "loop.preTearDown();");
+        writer.println(ident(prefix) + "control.preTearDown();");
 
         for (String s : states.getIterationTearDowns(method)) writer.println(ident(prefix) + s);
         writer.println();
 
-        writer.println(ident(prefix) + "if (loop.isLastIteration()) {");
+        writer.println(ident(prefix) + "if (control.isLastIteration()) {");
         for (String s : states.getRunTearDowns(method)) writer.println(ident(prefix + 1) + s);
         writer.println(ident(prefix) + "}");
     }
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/LoopMicroBenchmarkHandler.java	Sat Aug 17 13:21:15 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/LoopMicroBenchmarkHandler.java	Sat Aug 17 14:07:36 2013 +0400
@@ -26,7 +26,7 @@
 
 
 import org.openjdk.jmh.annotations.Mode;
-import org.openjdk.jmh.logic.Loop;
+import org.openjdk.jmh.logic.InfraControl;
 import org.openjdk.jmh.logic.results.IterationData;
 import org.openjdk.jmh.logic.results.Result;
 import org.openjdk.jmh.output.format.OutputFormat;
@@ -45,7 +45,7 @@
 import java.util.concurrent.TimeoutException;
 
 /**
- * Handler for a single micro benchmark (with Loop).
+ * Handler for a single micro benchmark (with InfraControl).
  * Handles name and execution information (# iterations, et c). Executes the
  * benchmark according to above parameters.
  *
@@ -93,12 +93,12 @@
 
         IterationData iterationResults = new IterationData(microbenchmark, numThreads, runtime);
 
-        Loop loop = new Loop(numThreads, shouldSynchIterations, runtime, preSetupBarrier, preTearDownBarrier, last, timeUnit);
+        InfraControl control = new InfraControl(numThreads, shouldSynchIterations, runtime, preSetupBarrier, preTearDownBarrier, last, timeUnit);
 
         BenchmarkTask[] runners = new BenchmarkTask[numThreads];
         for (int i = 0; i < runners.length; i++) {
 
-            runners[i] = new BenchmarkTask(threadLocal, loop);
+            runners[i] = new BenchmarkTask(threadLocal, control);
         }
 
         // submit tasks to threadpool
@@ -115,7 +115,7 @@
         }
         startProfilers();
 
-        loop.enable();
+        control.enable();
 
         // wait for all threads to stop executing
         try {
@@ -177,42 +177,42 @@
          */
         private final ThreadLocal<InstanceProvider> invocationHandler;
         /**
-         * Loop variable
+         * InfraControl variable
          */
-        private final Loop loop;
+        private final InfraControl control;
 
         /**
          * Constructor
          *
          * @param invocationHandler    instance to execute on
-         * @param loop       Loop variable
+         * @param control       InfraControl variable
          */
-        BenchmarkTask(ThreadLocal<InstanceProvider> invocationHandler, Loop loop) {
+        BenchmarkTask(ThreadLocal<InstanceProvider> invocationHandler, InfraControl control) {
             this.invocationHandler = invocationHandler;
-            this.loop = loop;
+            this.control = control;
         }
 
         @Override
         public Result call() throws Exception {
             Result r;
             try {
-                r = invokeBenchmark(invocationHandler.get().getInstance(), loop);
+                r = invokeBenchmark(invocationHandler.get().getInstance(), control);
 
             } catch (Throwable e) {
                 // about to fail the iteration;
                 // compensate for missed sync-iteration latches, we don't care about that anymore
-                loop.preSetupForce();
-                loop.preTearDownForce();
+                control.preSetupForce();
+                control.preTearDownForce();
 
                 if (shouldSynchIterations) {
                     try {
-                        loop.announceWarmupReady();
+                        control.announceWarmupReady();
                     } catch (Exception e1) {
                         // more threads than expected
                     }
 
                     try {
-                        loop.announceWarmdownReady();
+                        control.announceWarmdownReady();
                     } catch (Exception e1) {
                         // more threads than expected
                     }
@@ -227,16 +227,16 @@
         /**
          * Helper method for running the benchmark in a given instance.
          *
-         * @param loop      Loop logic instance
+         * @param control      InfraControl logic instance
          * @return the Result of the execution
          * @throws Exception if something went wrong
          */
 
-        private Result invokeBenchmark(Object instance, Loop loop) throws Throwable {
+        private Result invokeBenchmark(Object instance, InfraControl control) throws Throwable {
             Result result;
             if (method != null) {
                 try {
-                    result = (Result) method.invoke(instance, loop);
+                    result = (Result) method.invoke(instance, control);
                 } catch (IllegalAccessException e) {
                     throw new RuntimeException("Can't invoke " + method.getDeclaringClass().getName() + "." + method.getName(), e);
                 } catch (InvocationTargetException e) {
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/MicroBenchmarkHandlers.java	Sat Aug 17 13:21:15 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/MicroBenchmarkHandlers.java	Sat Aug 17 14:07:36 2013 +0400
@@ -25,7 +25,7 @@
 package org.openjdk.jmh.runner;
 
 import org.openjdk.jmh.annotations.MicroBenchmark;
-import org.openjdk.jmh.logic.Loop;
+import org.openjdk.jmh.logic.InfraControl;
 import org.openjdk.jmh.logic.results.Result;
 import org.openjdk.jmh.output.format.OutputFormat;
 import org.openjdk.jmh.runner.options.BaseOptions;
@@ -88,7 +88,7 @@
             return false;
         }
 
-        if (parameterTypes[0] != Loop.class) {
+        if (parameterTypes[0] != InfraControl.class) {
             return false;
         }
 
--- a/jmh-core/src/test/java/org/openjdk/jmh/runner/options/TestOptions.java	Sat Aug 17 13:21:15 2013 +0400
+++ b/jmh-core/src/test/java/org/openjdk/jmh/runner/options/TestOptions.java	Sat Aug 17 14:07:36 2013 +0400
@@ -199,16 +199,6 @@
     public void dummyMethod2() {
     }
 
-//    @MicroBenchmark(iterations = 100, jvmArgs = "apa", share = false, threads = 100, time = 3)
-//    public Result dummyMethod(Loop loop) {
-//        return null;
-//    }
-//
-//    @MicroBenchmark(iterations = 100, jvmArgs = "apa", share = false, time = 3)
-//    public Result dummyMethod2(Loop loop) {
-//        return null;
-//    }
-
     @Test
     public void testWarmupWithArg() throws Exception {
         String[] argv = {"-w", "100"};