[PATCH for preview] Add version and effective JVM path to the JSON output
Jens Wilke
jw_list at headissue.com
Mon Apr 3 03:46:52 UTC 2017
Add version and effective JVM path to the JSON output
patch is against current snapshot. Not yet ready for submission, however the patch generally works and can be tested. Things to note:
I got spurious errors about wrong JavaDoc. That's why some JavaDoc fixes are sprinkled in, sorry
JVM version is included in the JSON file with the same print format we currently have. Example: "jvmVersion" : "JDK 1.8.0_121, VM 25.121-b13".
This is bad. We should have different fields for it and name it java.version and java.vm.version. To have the distinct values I tend to
change VersionMain to return the complete system properties in properties file format. Thoughts?
To have arbitrary strings in JSON is a major change. At the moment JMH is doing some tidying and pretty printing of the JSON via regular expressions.
This fails for arbitrary string content. That might prove a bad trap, when there is the wrong character in a parameter. Options: Replace tidying maybe
even writing with a library; low tech: escape all special characters in strings, tidy, then replace back. I already added commons lang3 as
dependency to have JSON string escaping. Thoughts?
BTW: I spend also some thoughts on recording the available CPUs, but it goes better in a separate patch.
Enjoy,
Jens
---
diff -r 36a2ee9a075e jmh-core/pom.xml
--- a/jmh-core/pom.xml Tue Mar 28 18:34:51 2017 +0200
+++ b/jmh-core/pom.xml Mon Apr 03 10:16:47 2017 +0700
@@ -65,10 +65,15 @@ questions.
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.2</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.5</version>
+ </dependency>
</dependencies>
<prerequisites>
<maven>3.0</maven>
</prerequisites>
diff -r 36a2ee9a075e jmh-core/src/main/java/org/openjdk/jmh/infra/BenchmarkParams.java
--- a/jmh-core/src/main/java/org/openjdk/jmh/infra/BenchmarkParams.java Tue Mar 28 18:34:51 2017 +0200
+++ b/jmh-core/src/main/java/org/openjdk/jmh/infra/BenchmarkParams.java Mon Apr 03 10:16:47 2017 +0700
@@ -26,10 +26,11 @@ package org.openjdk.jmh.infra;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.runner.WorkloadParams;
import org.openjdk.jmh.runner.options.TimeValue;
import org.openjdk.jmh.util.Utils;
+import org.openjdk.jmh.util.Version;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
@@ -67,20 +68,21 @@ public class BenchmarkParams extends Ben
int threads, int[] threadGroups, Collection<String> threadGroupLabels,
int forks, int warmupForks,
IterationParams warmup, IterationParams measurement,
Mode mode, WorkloadParams params,
TimeUnit timeUnit, int opsPerInvocation,
- String jvm, Collection<String> jvmArgs,
- TimeValue timeout) {
+ String jvm, Collection<String> jvmArgs, String jvmVersion,
+ TimeValue timeout, String jmhVersion) {
super(benchmark, generatedTarget, synchIterations,
threads, threadGroups, threadGroupLabels,
forks, warmupForks,
warmup, measurement,
mode, params,
timeUnit, opsPerInvocation,
- jvm, jvmArgs, timeout);
+ jvm, jvmArgs, jvmVersion, timeout, jmhVersion);
}
+
}
abstract class BenchmarkParamsL4 extends BenchmarkParamsL3 {
private static final long serialVersionUID = -2409216922027695385L;
@@ -89,20 +91,20 @@ abstract class BenchmarkParamsL4 extends
int threads, int[] threadGroups, Collection<String> threadGroupLabels,
int forks, int warmupForks,
IterationParams warmup, IterationParams measurement,
Mode mode, WorkloadParams params,
TimeUnit timeUnit, int opsPerInvocation,
- String jvm, Collection<String> jvmArgs,
- TimeValue timeout) {
+ String jvm, Collection<String> jvmArgs, String jvmVersion,
+ TimeValue timeout, String jmhVersion) {
super(benchmark, generatedTarget, synchIterations,
threads, threadGroups, threadGroupLabels,
forks, warmupForks,
warmup, measurement,
mode, params,
timeUnit, opsPerInvocation,
- jvm, jvmArgs,
- timeout);
+ jvm, jvmArgs, jvmVersion,
+ timeout, jmhVersion);
}
}
abstract class BenchmarkParamsL3 extends BenchmarkParamsL2 {
private static final long serialVersionUID = -53511295235994554L;
@@ -128,20 +130,20 @@ abstract class BenchmarkParamsL3 extends
int threads, int[] threadGroups, Collection<String> threadGroupLabels,
int forks, int warmupForks,
IterationParams warmup, IterationParams measurement,
Mode mode, WorkloadParams params,
TimeUnit timeUnit, int opsPerInvocation,
- String jvm, Collection<String> jvmArgs,
- TimeValue timeout) {
+ String jvm, Collection<String> jvmArgs, String jvmVersion,
+ TimeValue timeout, String jmhVersion) {
super(benchmark, generatedTarget, synchIterations,
threads, threadGroups, threadGroupLabels,
forks, warmupForks,
warmup, measurement,
mode, params,
timeUnit, opsPerInvocation,
- jvm, jvmArgs,
- timeout);
+ jvm, jvmArgs, jvmVersion,
+ timeout, jmhVersion);
}
}
abstract class BenchmarkParamsL1 extends BenchmarkParamsL0 {
private boolean p001, p002, p003, p004, p005, p006, p007, p008;
@@ -183,20 +185,22 @@ abstract class BenchmarkParamsL2 extends
protected final WorkloadParams params;
protected final TimeUnit timeUnit;
protected final int opsPerInvocation;
protected final String jvm;
protected final Collection<String> jvmArgs;
+ protected final String jvmVersion;
protected final TimeValue timeout;
+ protected final String jmhVersion;
public BenchmarkParamsL2(String benchmark, String generatedTarget, boolean synchIterations,
int threads, int[] threadGroups, Collection<String> threadGroupLabels,
int forks, int warmupForks,
IterationParams warmup, IterationParams measurement,
Mode mode, WorkloadParams params,
TimeUnit timeUnit, int opsPerInvocation,
- String jvm, Collection<String> jvmArgs,
- TimeValue timeout) {
+ String jvm, Collection<String> jvmArgs, String jvmVersion,
+ TimeValue timeout, String jmhVersion) {
this.benchmark = benchmark;
this.generatedTarget = generatedTarget;
this.synchIterations = synchIterations;
this.threads = threads;
this.threadGroups = threadGroups;
@@ -209,11 +213,13 @@ abstract class BenchmarkParamsL2 extends
this.params = params;
this.timeUnit = timeUnit;
this.opsPerInvocation = opsPerInvocation;
this.jvm = jvm;
this.jvmArgs = jvmArgs;
+ this.jvmVersion = jvmVersion;
this.timeout = timeout;
+ this.jmhVersion = jmhVersion;
}
/**
* @return how long to wait for iteration to complete
*/
@@ -331,21 +337,39 @@ abstract class BenchmarkParamsL2 extends
*/
public String generatedBenchmark() {
return generatedTarget;
}
+ /**
+ * @return JVM executable path
+ */
public String getJvm() {
return jvm;
}
/**
+ * @return JMH version identical to {@link Version#getPlainVersion()}, but output format should
+ * get there input via bean for testing purposes.
+ */
+ public String getJmhVersion() {
+ return jmhVersion;
+ }
+
+ /**
* @return JVM options
*/
public Collection<String> getJvmArgs() {
return Collections.unmodifiableCollection(jvmArgs);
}
+ /**
+ * @return version information as returned by the effective target JVM,
+ * combined {@code java.version} and {@code java.vm.version}
+ * @see Version
+ */
+ public String getJvmVersion() { return jvmVersion; }
+
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
diff -r 36a2ee9a075e jmh-core/src/main/java/org/openjdk/jmh/infra/Blackhole.java
--- a/jmh-core/src/main/java/org/openjdk/jmh/infra/Blackhole.java Tue Mar 28 18:34:51 2017 +0200
+++ b/jmh-core/src/main/java/org/openjdk/jmh/infra/Blackhole.java Mon Apr 03 10:16:47 2017 +0700
@@ -286,10 +286,12 @@ public final class Blackhole extends Bla
/**
* Make any consumed data begone.
*
* WARNING: This method should only be called by the infrastructure code, in clearly understood cases.
* Even though it is public, it is not supposed to be called by users.
+ *
+ * @param challengeResponse arbitrary string
*/
public void evaporate(String challengeResponse) {
if (!challengeResponse.equals("Yes, I am Stephen Hawking, and know a thing or two about black holes.")) {
throw new IllegalStateException("Who are you?");
}
diff -r 36a2ee9a075e jmh-core/src/main/java/org/openjdk/jmh/results/Result.java
--- a/jmh-core/src/main/java/org/openjdk/jmh/results/Result.java Tue Mar 28 18:34:51 2017 +0200
+++ b/jmh-core/src/main/java/org/openjdk/jmh/results/Result.java Mon Apr 03 10:16:47 2017 +0700
@@ -184,13 +184,12 @@ public abstract class Result<T extends R
protected T getZeroResult() {
return null;
}
/**
- * Get derivative results for this result. These do not participate in aggregation,
- * and computed on the spot from the aggregated result.
- * @return
+ * @return derivative results for this result. These do not participate in aggregation,
+ * and computed on the spot from the aggregated result.
*/
protected Collection<? extends Result> getDerivativeResults() {
return Collections.emptyList();
}
diff -r 36a2ee9a075e jmh-core/src/main/java/org/openjdk/jmh/results/format/JSONResultFormat.java
--- a/jmh-core/src/main/java/org/openjdk/jmh/results/format/JSONResultFormat.java Tue Mar 28 18:34:51 2017 +0200
+++ b/jmh-core/src/main/java/org/openjdk/jmh/results/format/JSONResultFormat.java Mon Apr 03 10:16:47 2017 +0700
@@ -22,17 +22,20 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.jmh.results.format;
+import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.lang3.StringUtils;
import org.openjdk.jmh.infra.BenchmarkParams;
import org.openjdk.jmh.results.BenchmarkResult;
import org.openjdk.jmh.results.IterationResult;
import org.openjdk.jmh.results.Result;
import org.openjdk.jmh.results.RunResult;
import org.openjdk.jmh.util.Statistics;
import org.openjdk.jmh.util.Utils;
+import org.openjdk.jmh.util.Version;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
@@ -67,14 +70,22 @@ class JSONResultFormat implements Result
} else {
pw.println(",");
}
pw.println("{");
+ pw.println("\"jmhVersion\" : \"" + params.getJmhVersion() + "\",");
pw.println("\"benchmark\" : \"" + params.getBenchmark() + "\",");
pw.println("\"mode\" : \"" + params.getMode().shortLabel() + "\",");
pw.println("\"threads\" : " + params.getThreads() + ",");
pw.println("\"forks\" : " + params.getForks() + ",");
+ pw.println("\"jvm\" : \"" + StringEscapeUtils.escapeJson(params.getJvm().replace(',', ';')) + "\",");
+ // if empty, write an empty array.
+ pw.println("\"jvmArgs\" : [");
+ printStringArray(pw, params.getJvmArgs());
+ pw.println("],");
+ // FIXME: the string contains JDK and VM versions, should be separate JSON field
+ pw.println("\"jvmVersion\" : \"" + StringEscapeUtils.escapeJson(params.getJvmVersion().replace(',', ';')) + "\",");
pw.println("\"warmupIterations\" : " + params.getWarmup().getCount() + ",");
pw.println("\"warmupTime\" : \"" + params.getWarmup().getTime() + "\",");
pw.println("\"warmupBatchSize\" : " + params.getWarmup().getBatchSize() + ",");
pw.println("\"measurementIterations\" : " + params.getMeasurement().getCount() + ",");
pw.println("\"measurementTime\" : \"" + params.getMeasurement().getTime() + "\",");
@@ -232,10 +243,11 @@ class JSONResultFormat implements Result
if (d == Double.POSITIVE_INFINITY)
return "\"+INF\"";
return String.valueOf(d);
}
+ // FIXME: not working for arbitrary strings, e.g. containing a comma
private String tidy(String s) {
s = s.replaceAll("\r", "");
s = s.replaceAll("\n", " ");
s = s.replaceAll(",", ",\n");
s = s.replaceAll("\\{", "{\n");
@@ -290,6 +302,20 @@ class JSONResultFormat implements Result
}
sb.append(rightBracket);
return sb.toString();
}
+ private static void printStringArray(PrintWriter pw, Collection<String> col) {
+ boolean isFirst = true;
+ for (String e : col) {
+ if (isFirst) {
+ isFirst = false;
+ } else {
+ pw.print(',');
+ }
+ pw.print('"');
+ pw.print(StringEscapeUtils.escapeJson(e));
+ pw.print('"');
+ }
+ }
+
}
diff -r 36a2ee9a075e jmh-core/src/main/java/org/openjdk/jmh/runner/Runner.java
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/Runner.java Tue Mar 28 18:34:51 2017 +0200
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/Runner.java Mon Apr 03 10:16:47 2017 +0700
@@ -463,10 +463,14 @@ public class Runner extends BaseRunner {
Defaults.OPS_PER_INVOCATION));
String jvm = options.getJvm().orElse(
benchmark.getJvm().orElse(Utils.getCurrentJvm()));
+ String jvmVersion =
+ jvm.equals(Utils.getCurrentJvm()) ?
+ Utils.getCurrentJvmVersion() : Utils.join(Utils.runWith(getVersionMainCommand(jvm)), ", ");
+
Collection<String> jvmArgs = new ArrayList<>();
jvmArgs.addAll(options.getJvmArgsPrepend().orElse(
benchmark.getJvmArgsPrepend().orElse(Collections.<String>emptyList())));
@@ -481,11 +485,11 @@ public class Runner extends BaseRunner {
return new BenchmarkParams(benchmark.getUsername(), benchmark.generatedTarget(), synchIterations,
threads, threadGroups, benchmark.getThreadGroupLabels().orElse(Collections.<String>emptyList()),
forks, warmupForks,
warmup, measurement, benchmark.getMode(), benchmark.getWorkloadParams(), timeUnit, opsPerInvocation,
- jvm, jvmArgs, timeout);
+ jvm, jvmArgs, jvmVersion, timeout, Version.getPlainVersion());
}
private List<WorkloadParams> explodeAllParams(BenchmarkListEntry br) throws RunnerException {
Map<String, String[]> benchParams = br.getParams().orElse(Collections.<String, String[]>emptyMap());
List<WorkloadParams> ps = new ArrayList<>();
@@ -597,19 +601,17 @@ public class Runner extends BaseRunner {
boolean forcePrint = options.verbosity().orElse(Defaults.VERBOSITY).equalsOrHigherThan(VerboseMode.EXTRA);
printOut = forcePrint || printOut;
printErr = forcePrint || printErr;
- List<String> versionString = getVersionMainCommand(params);
-
String opts = Utils.join(params.getJvmArgs(), " ");
if (opts.trim().isEmpty()) {
opts = "<none>";
}
out.println("# " + Version.getVersion());
- out.print("# VM version: " + Utils.join(Utils.runWith(versionString), "\n"));
+ out.print("# VM version: " + params.getJvmVersion());
out.println("# VM invoker: " + params.getJvm());
out.println("# VM options: " + opts);
out.startBenchmark(params);
out.println("");
@@ -833,15 +835,15 @@ public class Runner extends BaseRunner {
}
/**
* @return
*/
- List<String> getVersionMainCommand(BenchmarkParams benchmark) {
+ List<String> getVersionMainCommand(String jvm) {
List<String> command = new ArrayList<>();
// use supplied jvm, if given
- command.add(benchmark.getJvm());
+ command.add(jvm);
// assemble final process command
command.add("-cp");
if (Utils.isWindows()) {
command.add('"' + System.getProperty("java.class.path") + '"');
diff -r 36a2ee9a075e jmh-core/src/main/java/org/openjdk/jmh/util/FileUtils.java
--- a/jmh-core/src/main/java/org/openjdk/jmh/util/FileUtils.java Tue Mar 28 18:34:51 2017 +0200
+++ b/jmh-core/src/main/java/org/openjdk/jmh/util/FileUtils.java Mon Apr 03 10:16:47 2017 +0700
@@ -45,11 +45,11 @@ public class FileUtils {
* Creates the temp file, and retains it as long as the reference to it
* is reachable.
*
* @param suffix suffix
* @return temp file
- * @throws IOException
+ * @throws IOException if things go crazy
*/
public static TempFile weakTempFile(String suffix) throws IOException {
return TEMP_FILE_MANAGER.create(suffix);
}
@@ -61,11 +61,11 @@ public class FileUtils {
* Creates the temp file with given suffix. The file would be removed
* on JVM exit, or when caller deletes the file itself.
*
* @param suffix suffix
* @return temporary file
- * @throws IOException
+ * @throws IOException if things go crazy
*/
public static File tempFile(String suffix) throws IOException {
File file = File.createTempFile("jmh", suffix);
file.deleteOnExit();
return file;
diff -r 36a2ee9a075e jmh-core/src/main/java/org/openjdk/jmh/util/Version.java
--- a/jmh-core/src/main/java/org/openjdk/jmh/util/Version.java Tue Mar 28 18:34:51 2017 +0200
+++ b/jmh-core/src/main/java/org/openjdk/jmh/util/Version.java Mon Apr 03 10:16:47 2017 +0700
@@ -37,19 +37,45 @@ import java.util.concurrent.TimeUnit;
public class Version {
private static final int UPDATE_INTERVAL = 180;
+ /**
+ * @return the version, build date and update hint.
+ */
public static String getVersion() {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
printVersion(pw);
pw.close();
return sw.toString();
}
+ /**
+ * @return only version, e.g. "1.19", or "-" if the version cannot be determined.
+ */
+ public static String getPlainVersion() {
+ Properties p = new Properties();
+ InputStream s = Version.class.getResourceAsStream("/jmh.properties");
+ if (s == null) {
+ return "-";
+ }
+ try {
+ p.load(s);
+ } catch (IOException e) {
+ return "-";
+ } finally {
+ FileUtils.safelyClose(s);
+ }
+ String version = (String) p.get("jmh.version");
+ if (version == null) {
+ return "-";
+ }
+ return version;
+ }
+
private static void printVersion(PrintWriter pw) {
Properties p = new Properties();
InputStream s = Version.class.getResourceAsStream("/jmh.properties");
if (s == null) {
diff -r 36a2ee9a075e jmh-core/src/test/java/org/openjdk/jmh/results/TestAggregateResult.java
--- a/jmh-core/src/test/java/org/openjdk/jmh/results/TestAggregateResult.java Tue Mar 28 18:34:51 2017 +0200
+++ b/jmh-core/src/test/java/org/openjdk/jmh/results/TestAggregateResult.java Mon Apr 03 10:16:47 2017 +0700
@@ -30,10 +30,11 @@ import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.infra.BenchmarkParams;
import org.openjdk.jmh.infra.IterationParams;
import org.openjdk.jmh.runner.IterationType;
import org.openjdk.jmh.runner.options.TimeValue;
import org.openjdk.jmh.util.Utils;
+import org.openjdk.jmh.util.Version;
import java.util.Collections;
import java.util.concurrent.TimeUnit;
import static org.junit.Assert.assertEquals;
@@ -53,12 +54,12 @@ public class TestAggregateResult {
1, new int[]{1}, Collections.<String>emptyList(),
1, 1,
new IterationParams(IterationType.WARMUP, 1, TimeValue.seconds(1), 1),
new IterationParams(IterationType.MEASUREMENT, 1, TimeValue.seconds(1), 1),
Mode.Throughput, null, TimeUnit.SECONDS, 1,
- Utils.getCurrentJvm(), Collections.<String>emptyList(),
- TimeValue.days(1)),
+ Utils.getCurrentJvm(), Collections.<String>emptyList(), Utils.getCurrentJvmVersion(),
+ TimeValue.days(1), Version.getPlainVersion()),
new IterationParams(IterationType.MEASUREMENT, 1, TimeValue.days(1), 1),
null
);
for (double d : values) {
result.addResult(new ThroughputResult(ResultRole.PRIMARY, "test1", (long) d, 10 * 1000 * 1000, TimeUnit.MILLISECONDS));
diff -r 36a2ee9a075e jmh-core/src/test/java/org/openjdk/jmh/results/format/ResultFormatTest.java
--- a/jmh-core/src/test/java/org/openjdk/jmh/results/format/ResultFormatTest.java Tue Mar 28 18:34:51 2017 +0200
+++ b/jmh-core/src/test/java/org/openjdk/jmh/results/format/ResultFormatTest.java Mon Apr 03 10:16:47 2017 +0700
@@ -44,10 +44,22 @@ import java.util.concurrent.TimeUnit;
* These tests seal the machine-readable format.
* Any change to these tests should be discussed with the maintainers first!
*/
public class ResultFormatTest {
+ /**
+ * Use constant dummy for JVM instead of current JVM to compare with golden file.
+ */
+ private static final String JVM_DUMMY = "javadummy";
+
+ /**
+ * Use constant dummy for JVM instead of current JVM to compare with golden file.
+ */
+ private static final String JVM_VERSION_DUMMY = "JDK 1.8-dummy, VM 4711";
+
+ private static final String JMH_VERSION_DUMMY = "1.18";
+
private Collection<RunResult> getStub() {
Collection<RunResult> results = new TreeSet<>(RunResult.DEFAULT_SORT_COMPARATOR);
Random r = new Random(12345);
Random ar = new Random(12345);
@@ -68,13 +80,14 @@ public class ResultFormatTest {
new IterationParams(IterationType.WARMUP, r.nextInt(1000), TimeValue.seconds(r.nextInt(1000)), 1),
new IterationParams(IterationType.MEASUREMENT, r.nextInt(1000), TimeValue.seconds(r.nextInt(1000)), 1),
Mode.Throughput,
ps,
TimeUnit.SECONDS, 1,
- Utils.getCurrentJvm(),
+ JVM_DUMMY,
Collections.<String>emptyList(),
- TimeValue.days(1));
+ JVM_VERSION_DUMMY,
+ TimeValue.days(1), JMH_VERSION_DUMMY);
Collection<BenchmarkResult> benchmarkResults = new ArrayList<>();
for (int f = 0; f < r.nextInt(10); f++) {
Collection<IterationResult> iterResults = new ArrayList<>();
for (int c = 0; c < r.nextInt(10); c++) {
@@ -109,11 +122,12 @@ public class ResultFormatTest {
String actualFileName = "test." + type.toString().toLowerCase() + suffix;
String goldenFileName = "output-golden." + type.toString().toLowerCase() + suffix;
try {
- String actualFile = FileUtils.tempFile(actualFileName).getAbsolutePath();
+ // String actualFile = FileUtils.tempFile(actualFileName).getAbsolutePath();
+ String actualFile = "/home/jeans/jmh-" + actualFileName;
ResultFormatFactory.getInstance(type, actualFile).writeOut(getStub());
compare(actualFile, goldenFileName);
PrintStream ps = new PrintStream(actualFile, "UTF-8");
ResultFormatFactory.getInstance(type, ps).writeOut(getStub());
diff -r 36a2ee9a075e jmh-core/src/test/java/org/openjdk/jmh/runner/RunnerTest.java
--- a/jmh-core/src/test/java/org/openjdk/jmh/runner/RunnerTest.java Tue Mar 28 18:34:51 2017 +0200
+++ b/jmh-core/src/test/java/org/openjdk/jmh/runner/RunnerTest.java Mon Apr 03 10:16:47 2017 +0700
@@ -31,10 +31,11 @@ import org.openjdk.jmh.infra.IterationPa
import org.openjdk.jmh.profile.ExternalProfiler;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.openjdk.jmh.runner.options.TimeValue;
import org.openjdk.jmh.util.FileUtils;
import org.openjdk.jmh.util.Utils;
+import org.openjdk.jmh.util.Version;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
@@ -62,12 +63,12 @@ public class RunnerTest {
1, new int[]{1}, Collections.<String>emptyList(),
1, 1,
new IterationParams(IterationType.WARMUP, 1, TimeValue.seconds(1), 1),
new IterationParams(IterationType.MEASUREMENT, 1, TimeValue.seconds(1), 1),
Mode.Throughput, null, TimeUnit.SECONDS, 1,
- Utils.getCurrentJvm(), Collections.<String>emptyList(),
- TimeValue.days(1));
+ Utils.getCurrentJvm(), Collections.<String>emptyList(), Utils.getCurrentJvmVersion(),
+ TimeValue.days(1), Version.getPlainVersion());
List<String> command = blade.getForkedMainCommand(bp, Collections.<ExternalProfiler>emptyList(), DUMMY_HOST, DUMMY_PORT);
// expecting 1 compile command file
List<String> files = CompilerHints.getCompileCommandFiles(command);
assertEquals(1, files.size());
@@ -93,12 +94,12 @@ public class RunnerTest {
1, new int[]{1}, Collections.<String>emptyList(),
1, 1,
new IterationParams(IterationType.WARMUP, 1, TimeValue.seconds(1), 1),
new IterationParams(IterationType.MEASUREMENT, 1, TimeValue.seconds(1), 1),
Mode.Throughput, null, TimeUnit.SECONDS, 1,
- Utils.getCurrentJvm(), Collections.singletonList(CompilerHints.XX_COMPILE_COMMAND_FILE + tempHints),
- TimeValue.days(1));
+ Utils.getCurrentJvm(), Collections.singletonList(CompilerHints.XX_COMPILE_COMMAND_FILE + tempHints), Utils.getCurrentJvmVersion(),
+ TimeValue.days(1), Version.getPlainVersion());
List<String> command = blade.getForkedMainCommand(bp, Collections.<ExternalProfiler>emptyList(), DUMMY_HOST, DUMMY_PORT);
// expecting 1 compile command file
List<String> files = CompilerHints.getCompileCommandFiles(command);
assertEquals(1, files.size());
@@ -129,12 +130,12 @@ public class RunnerTest {
1, 1,
new IterationParams(IterationType.WARMUP, 1, TimeValue.seconds(1), 1),
new IterationParams(IterationType.MEASUREMENT, 1, TimeValue.seconds(1), 1),
Mode.Throughput, null, TimeUnit.SECONDS, 1,
Utils.getCurrentJvm(),
- Arrays.asList(CompilerHints.XX_COMPILE_COMMAND_FILE + tempHints1, CompilerHints.XX_COMPILE_COMMAND_FILE + tempHints2),
- TimeValue.days(1));
+ Arrays.asList(CompilerHints.XX_COMPILE_COMMAND_FILE + tempHints1, CompilerHints.XX_COMPILE_COMMAND_FILE + tempHints2), Utils.getCurrentJvmVersion(),
+ TimeValue.days(1), Version.getPlainVersion());
List<String> command = blade.getForkedMainCommand(bp, Collections.<ExternalProfiler>emptyList(), DUMMY_HOST, DUMMY_PORT);
// expecting 1 compile command file
List<String> files = CompilerHints.getCompileCommandFiles(command);
assertEquals(1, files.size());
diff -r 36a2ee9a075e jmh-core/src/test/resources/org/openjdk/jmh/results/format/output-golden.json
--- a/jmh-core/src/test/resources/org/openjdk/jmh/results/format/output-golden.json Tue Mar 28 18:34:51 2017 +0200
+++ b/jmh-core/src/test/resources/org/openjdk/jmh/results/format/output-golden.json Mon Apr 03 10:16:47 2017 +0700
@@ -1,11 +1,16 @@
[
{
+ "jmhVersion" : "1.18",
"benchmark" : "benchmark_0",
"mode" : "thrpt",
"threads" : 80,
"forks" : 828,
+ "jvm" : "javadummy",
+ "jvmArgs" : [
+ ],
+ "jvmVersion" : "JDK 1.8-dummy, VM 4711",
"warmupIterations" : 84,
"warmupTime" : "375 s",
"warmupBatchSize" : 1,
"measurementIterations" : 802,
"measurementTime" : "501 s",
@@ -214,14 +219,19 @@
]
}
}
},
{
+ "jmhVersion" : "1.18",
"benchmark" : "benchmark_1",
"mode" : "thrpt",
"threads" : 900,
"forks" : 364,
+ "jvm" : "javadummy",
+ "jvmArgs" : [
+ ],
+ "jvmVersion" : "JDK 1.8-dummy, VM 4711",
"warmupIterations" : 544,
"warmupTime" : "409 s",
"warmupBatchSize" : 1,
"measurementIterations" : 55,
"measurementTime" : "398 s",
@@ -313,14 +323,19 @@
]
}
}
},
{
+ "jmhVersion" : "1.18",
"benchmark" : "benchmark_2",
"mode" : "thrpt",
"threads" : 466,
"forks" : 677,
+ "jvm" : "javadummy",
+ "jvmArgs" : [
+ ],
+ "jvmVersion" : "JDK 1.8-dummy, VM 4711",
"warmupIterations" : 384,
"warmupTime" : "105 s",
"warmupBatchSize" : 1,
"measurementIterations" : 461,
"measurementTime" : "96 s",
@@ -474,14 +489,19 @@
]
}
}
},
{
+ "jmhVersion" : "1.18",
"benchmark" : "benchmark_3",
"mode" : "thrpt",
"threads" : 968,
"forks" : 581,
+ "jvm" : "javadummy",
+ "jvmArgs" : [
+ ],
+ "jvmVersion" : "JDK 1.8-dummy, VM 4711",
"warmupIterations" : 628,
"warmupTime" : "207 s",
"warmupBatchSize" : 1,
"measurementIterations" : 857,
"measurementTime" : "438 s",
@@ -667,14 +687,19 @@
]
}
}
},
{
+ "jmhVersion" : "1.18",
"benchmark" : "benchmark_4",
"mode" : "thrpt",
"threads" : 739,
"forks" : 670,
+ "jvm" : "javadummy",
+ "jvmArgs" : [
+ ],
+ "jvmVersion" : "JDK 1.8-dummy, VM 4711",
"warmupIterations" : 997,
"warmupTime" : "651 s",
"warmupBatchSize" : 1,
"measurementIterations" : 16,
"measurementTime" : "763 s",
--
"Everything superfluous is wrong!"
// Jens Wilke - headissue GmbH - Germany
\// https://headissue.com
More information about the jmh-dev
mailing list