I am developing an integrated Benchmarking into an application. I want to use JMH as my framework.
How can I receive the results as an JSON object?
I know I can save it in a file with the following running options:
org.openjdk.jmh.runner.options.Options opt = new OptionsBuilder()
.include(WorkerBenBenchmarkObject.class.getSimpleName())
.shouldDoGC(true)
.resultFormat(ResultFormatType.JSON)
.result("benchmark-result/" + System.currentTimeMillis() + ".json")
.addProfiler(StackProfiler.class)
.jvmArgsAppend("-Djmh.stack.period=1")
.warmupIterations(5)
.measurementIterations(5)
.forks(1)
.build();
new Runner(opt).run();
How can I receive this results without needing to read the file?