changeset 435:415fc7ca4340

Yak shaving: proper newlines in the generated code.
author shade
date Fri, 28 Feb 2014 03:09:00 +0400
parents 90b8b2c8934b
children 17da11daec6b
files jmh-core/src/main/java/org/openjdk/jmh/generators/core/BenchmarkGenerator.java
diffstat 1 files changed, 9 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/generators/core/BenchmarkGenerator.java	Fri Feb 28 02:57:25 2014 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/generators/core/BenchmarkGenerator.java	Fri Feb 28 03:09:00 2014 +0400
@@ -559,7 +559,6 @@
     private void generateThroughput(PrintWriter writer, Mode benchmarkKind, MethodGroup methodGroup, StateObjectHandler states) {
         writer.println(ident(1) + "public Collection<? extends Result> " + methodGroup.getName() + "_" + benchmarkKind +
                 "(InfraControl control, ThreadControl threadControl) throws Throwable {");
-        writer.println();
 
         methodProlog(writer, methodGroup);
 
@@ -631,14 +630,14 @@
             writer.println(ident(2) + "} else");
         }
         writer.println(ident(3) + "throw new IllegalStateException(\"Harness failed to distribute threads among groups properly\");");
+        writer.println(ident(1) + "}");
+
         writer.println();
 
-        writer.println(ident(1) + "}");
-
         // measurement loop bodies
         for (MethodInfo method : methodGroup.methods()) {
             String methodName = method.getName() + "_" + benchmarkKind + "_measurementLoop";
-            writer.println(ident(1) + "public " + (methodGroup.isStrictFP() ? "strictfp" : "") + " void " + methodName + "(InfraControl control, RawResults result, " + states.getImplicit("bench").toTypeDef() + ", " + states.getImplicit("blackhole").toTypeDef() + prefix(states.getTypeArgList(method)) + ") throws Throwable {");
+            writer.println(ident(1) + "public" + (methodGroup.isStrictFP() ? " strictfp" : "") + " void " + methodName + "(InfraControl control, RawResults result, " + states.getImplicit("bench").toTypeDef() + ", " + states.getImplicit("blackhole").toTypeDef() + prefix(states.getTypeArgList(method)) + ") throws Throwable {");
             writer.println(ident(2) + "long operations = 0;");
             writer.println(ident(2) + "long realTime = 0;");
             writer.println(ident(2) + "result.startTime = System.nanoTime();");
@@ -730,13 +729,13 @@
             writer.println(ident(2) + "} else");
         }
         writer.println(ident(3) + "throw new IllegalStateException(\"Harness failed to distribute threads among groups properly\");");
+        writer.println(ident(1) + "}");
+
         writer.println();
 
-        writer.println(ident(1) + "}");
-
         // measurement loop bodies
         for (MethodInfo method : methodGroup.methods()) {
-            writer.println(ident(1) + "public " + (methodGroup.isStrictFP() ? "strictfp" : "") +  " void " + method.getName() + "_" + benchmarkKind + "_measurementLoop" +
+            writer.println(ident(1) + "public" + (methodGroup.isStrictFP() ? " strictfp" : "") +  " void " + method.getName() + "_" + benchmarkKind + "_measurementLoop" +
                     "(InfraControl control, RawResults result, " + states.getImplicit("bench").toTypeDef() + ", " + states.getImplicit("blackhole").toTypeDef() +
                     prefix(states.getTypeArgList(method)) + ") throws Throwable {");
             writer.println(ident(2) + "long operations = 0;");
@@ -773,7 +772,6 @@
     private void generateSampleTime(PrintWriter writer, Mode benchmarkKind, MethodGroup methodGroup, StateObjectHandler states) {
         writer.println(ident(1) + "public Collection<? extends Result> " + methodGroup.getName() + "_" + benchmarkKind +
                 "(InfraControl control, ThreadControl threadControl) throws Throwable {");
-        writer.println();
 
         methodProlog(writer, methodGroup);
 
@@ -841,12 +839,13 @@
             writer.println(ident(2) + "} else");
         }
         writer.println(ident(3) + "throw new IllegalStateException(\"Harness failed to distribute threads among groups properly\");");
+        writer.println(ident(1) + "}");
 
-        writer.println(ident(1) + "}");
+        writer.println();
 
         // measurement loop bodies
         for (MethodInfo method : methodGroup.methods()) {
-            writer.println(ident(1) + "public " + (methodGroup.isStrictFP() ? "strictfp" : "") + " void " + method.getName() + "_" + benchmarkKind + "_measurementLoop(InfraControl control, SampleBuffer buffer, " + states.getImplicit("bench").toTypeDef() + ", " + states.getImplicit("blackhole").toTypeDef() + prefix(states.getTypeArgList(method)) + ") throws Throwable {");
+            writer.println(ident(1) + "public" + (methodGroup.isStrictFP() ? " strictfp" : "") + " void " + method.getName() + "_" + benchmarkKind + "_measurementLoop(InfraControl control, SampleBuffer buffer, " + states.getImplicit("bench").toTypeDef() + ", " + states.getImplicit("blackhole").toTypeDef() + prefix(states.getTypeArgList(method)) + ") throws Throwable {");
             writer.println(ident(2) + "long realTime = 0;");
             writer.println(ident(2) + "int rnd = (int)System.nanoTime();");
             writer.println(ident(2) + "int rndMask = 0;");
@@ -921,8 +920,6 @@
             writer.println(ident(2) + "} else");
         }
         writer.println(ident(3) + "throw new IllegalStateException(\"Harness failed to distribute threads among groups properly\");");
-        writer.println();
-
         writer.println(ident(1) + "}");
     }