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

Filipp Zhinkin fzhinkin at openjdk.org
Mon Apr 22 19:47:40 UTC 2024


On Fri, 19 Apr 2024 17:17:49 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> 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
>
> jmh-core/src/main/java/org/openjdk/jmh/profile/XCTraceAsmProfiler.java line 157:
> 
>> 155:             return super.afterTrial(br, pid, stdOut, stdErr);
>> 156:         } finally {
>> 157:             XCTraceSupport.removeDirectory(temporaryDirectory);
> 
> Do you really need `finally` here? Can we just record the result from super and then do `removeDirectory`?

The intention was to remove the directory no matter what. 

`TempFile`s (like `hsLog`) should be removed by an on-exit hook, thanks to `deleteOnExit` called from `TempFileManager::create`. For directories, there's no such mechanism, so I decided to rely on `try-finally` instead.

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

PR Review Comment: https://git.openjdk.org/jmh/pull/130#discussion_r1575280136


More information about the jmh-dev mailing list