RFR: 7903696: JMH: Add xctrace-based perfasm profiler for macOS [v4]
Aleksey Shipilev
shade at openjdk.org
Tue Apr 23 09:12:40 UTC 2024
On Mon, 22 Apr 2024 20:10:55 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.
>
> Filipp Zhinkin has updated the pull request incrementally with one additional commit since the last revision:
>
> 7903696: Cleaned up the code
>
> - removed unneeded field initializers
> - encapsulated TraceElement's fields
All right. I tested this on some real-world benchmarks on my M1, and it seems to work very well. We might fix up more stuff after this initial integration lands, but there is no reason to wait for anything else to be resolved.
Good job! Thank you.
-------------
Marked as reviewed by shade (Committer).
PR Review: https://git.openjdk.org/jmh/pull/130#pullrequestreview-2016671209
More information about the jmh-dev
mailing list