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

Filipp Zhinkin fzhinkin at openjdk.org
Sun Apr 7 18:22:34 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 a profiler 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 three additional commits since the last revision:

 - 7903696: Removed an option unsupported by older xctrace version
 - 7903696: Support legacy backtrace format
 - 7903696: Detect xctrace using xcode-select

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

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

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

  Stats: 569 lines in 11 files changed: 495 ins; 33 del; 41 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