RFR: 7903696: JMH: Add xctrace-based perfasm profiler for macOS [v2]

Filipp Zhinkin fzhinkin at openjdk.org
Thu Apr 4 06:54:36 UTC 2024


> Currently, the only perfasm profiler available on macOS is dtraceasm.
> While it serves its purposes well, there are a few shortcomings: dtrace requires superuser privileges and it can only sample by timer interrupts.
> 
> Xcode comes with a performance-analysis tool called Instruments and it has a command-line tool, called xctrace.
> xctrace allows profiling an app using both timer interrupts and PMI, and it does not require superuser privileges.
> 
> This PR brings JMH profilers that uses xctrace on macOS.
> 
> There are two profilers:
> - XCTraceAsmProfiler, a perfasm profiler based on xctrace that works fine out of the box;
> - XCTraceNormProfiler, a perfnorm profiler that requires mandatory parameter, that has to be setup using Instruments UI.
> 
> The latter is added as a PoC and could be wiped out of this PR.
> 
> Unfortunately, `xctrace` exports data in XML format, thus most of the code is responsible for XML parsing.

Filipp Zhinkin has updated the pull request incrementally with four additional commits since the last revision:

 - 7903696: Improved error message
 - 7903696: Improved options description
 - 7903696: Removed XCTraceNormProfiler
 - 7903696: Make XCTraceAsmProfilerTest Reflection generator friendly

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

Changes:
  - all: https://git.openjdk.org/jmh/pull/130/files
  - new: https://git.openjdk.org/jmh/pull/130/files/68491aa2..77fefcd4

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jmh&pr=130&range=01
 - incr: https://webrevs.openjdk.org/?repo=jmh&pr=130&range=00-01

  Stats: 490 lines in 10 files changed: 21 ins; 450 del; 19 mod
  Patch: https://git.openjdk.org/jmh/pull/130.diff
  Fetch: git fetch https://git.openjdk.org/jmh.git pull/130/head:pull/130

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


More information about the jmh-dev mailing list