RFR: 7904060: Enable profiler classes to be reused outside of JMH

Galder Zamarreño galder at openjdk.org
Tue Jul 8 10:30:29 UTC 2025


This is the **fourth** 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 makes `ProfilerOptionFormatter` and `ProfilerUtils` classes public so that they can be reused by external profilers. An example of this usage can be seen [in this perf dwarf profiler used for native image JMH benchmarks](https://github.com/galderz/fibula/commit/43fffcf225ab163a97cf0703abe956144adf31e6).

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)
4. [Enable profiler classes to be reused outside of JMH](https://github.com/openjdk/jmh/pull/162)

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

Commit messages:
 - Enable profiler classes to be reused outside of JMH

Changes: https://git.openjdk.org/jmh/pull/162/files
  Webrev: https://webrevs.openjdk.org/?repo=jmh&pr=162&range=00
  Issue: https://bugs.openjdk.org/browse/CODETOOLS-7904060
  Stats: 2 lines in 2 files changed: 0 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jmh/pull/162.diff
  Fetch: git fetch https://git.openjdk.org/jmh.git pull/162/head:pull/162

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


More information about the jmh-dev mailing list