Integrated: 7903696: JMH: Add xctrace-based perfasm profiler for macOS

Filipp Zhinkin fzhinkin at openjdk.org
Tue Apr 23 14:01:44 UTC 2024


On Sat, 16 Mar 2024 15:49:18 GMT, Filipp Zhinkin <fzhinkin at openjdk.org> wrote:

> 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.

This pull request has now been integrated.

Changeset: 6d6ce631
Author:    Filipp Zhinkin <fzhinkin at openjdk.org>
Committer: Aleksey Shipilev <shade at openjdk.org>
URL:       https://git.openjdk.org/jmh/commit/6d6ce6315dc39d1d3abd0e3ac9eca9c38f767112
Stats:     4374 lines in 29 files changed: 4361 ins; 8 del; 5 mod

7903696: JMH: Add xctrace-based perfasm profiler for macOS

Reviewed-by: shade

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

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


More information about the jmh-dev mailing list