RFR: 7904059: Enable alternative Runner instantiation and Main reuse

Galder Zamarreño galder at openjdk.org
Tue Jul 8 09:51:07 UTC 2025


This is the **third** in a series of PRs that I will be sending over the next few days, which make extending JMH to benchmark Java code running as GraalVM native images more easily. The codename for this extension is Fibula. It can still work without this PRs but without them the extension has to duplicate code that exists in JMH, which is not desirable.

This PR refactors the main class to enable reuse of most of its logic, while allowing the construction of the `Runner` instance to be overridden by a subclass. An example of this override can be seen [here](https://github.com/galderz/fibula/commit/11bb06a3e30cfae61fb6d9319ee9cac1bf16d2d3).

Here is the PR list for reference:
1. [Make OutputFormatAdapter public](https://github.com/openjdk/jmh/pull/158)
2. [Enable BenchmarkParams construction to be overriden](https://github.com/openjdk/jmh/pull/160)
3. [Enable alternative Runner instantiation and Main reuse](https://github.com/openjdk/jmh/pull/161)

-------------

Commit messages:
 - Enable alternative Runner instantiation and Main reuse

Changes: https://git.openjdk.org/jmh/pull/161/files
  Webrev: https://webrevs.openjdk.org/?repo=jmh&pr=161&range=00
  Issue: https://bugs.openjdk.org/browse/CODETOOLS-7904059
  Stats: 72 lines in 1 file changed: 21 ins; 10 del; 41 mod
  Patch: https://git.openjdk.org/jmh/pull/161.diff
  Fetch: git fetch https://git.openjdk.org/jmh.git pull/161/head:pull/161

PR: https://git.openjdk.org/jmh/pull/161


More information about the jmh-dev mailing list