RFR: Rework Results API

Staffan Friberg staffan.friberg at oracle.com
Thu Aug 29 12:26:52 PDT 2013


Would it make sense to have a class that handles the result unit so you 
can ask if lower or higher result is better etc. instead of forcing the 
user to parse a String?

Once you integrate into a higher (or automatic) system know which is the 
better score becomes important.

//Staffan

On 2013-08-29 12:09, Aleksey Shipilev wrote:
> Hi again,
>
> Please review the cleanup for the Results API in JMH:
>    http://cr.openjdk.java.net/~shade/jmh/results-rework-1.webrev/
>    http://cr.openjdk.java.net/~shade/jmh/results-rework-1.changesets
>
> Overview:
>    - API now publishes proper RunResult; greatly revised
> RunResult/IterationResult interactions; pruned lots of redundant code
> along the way
>    - Results API is re-thinked in the following way: every benchmark
> always has the primary result, and unlimited number of named secondary
> results; this allows us to fold asymmetric benchmarks to report global
> primary score, as well as per-type secondary results
>    - Profiler results are available through the Results API, and we can
> now think to fold some of the profiling results to the secondary
> benchmark results to report them in human-readable report, fit them into
> the averaging, etc.
>    - OutputFormat and couple of internal classes is also retrofitted to
> make the internal API cleaner
>
> All in all, this allows me to do:
>
>      public static void main(String[] args) throws RunnerException {
>          Options opts = new OptionsBuilder()
>                  .include(".*")
>                  .warmupTime(TimeValue.milliseconds(100))
>                  .measurementTime(TimeValue.milliseconds(100))
>                  .jvmArgs("-server")
>                  .forks(5)
>                  .outputFormat(OutputFormatType.TextReport)
>                  .build();
>
>          RunResult runResult = new Runner(opts).runSingle();
>          Result result = runResult.getPrimaryResult();
>
>          System.out.println();
>          System.out.println("API replied benchmark score: "
>                    + result.getScore() + " "
>                    + result.getScoreUnit() + " over "
>                    + result.getStatistics().getN()
>                    + " iterations");
>      }
>
> API deserves a bit of polishing, but this is already very cool. ;)
>
> Thanks,
> Aleksey.



More information about the jmh-dev mailing list