RFR: 8080: Add support for enabling jfr on native images [v4]
Brice Dutheil
bdutheil at openjdk.org
Tue Jun 20 11:52:12 UTC 2023
On Tue, 13 Jun 2023 17:04:25 GMT, Alex Macdonald <aptmac at openjdk.org> wrote:
>> This PR addresses JMC-8080 [[0]](https://bugs.openjdk.org/browse/JMC-8080), in which it would be nice to add support for enabling flight recorder on GraalVM native images.
>>
>> Currently, trying to use the flight recording wizard on a connected native image ends up with an error dialog:
>> 
>>
>> The proposed solution here adds checks to determine if the vm is of type Substrate VM, and check if there is a flightrecording mbean registered.
>>
>> [0] https://bugs.openjdk.org/browse/JMC-8080
>
> Alex Macdonald has updated the pull request incrementally with one additional commit since the last revision:
>
> fix typo
Marked as reviewed by bdutheil (Author).
There's not not much in the ticket. The code suggests it's only about discovering and controlling JFR.
For me this seems to be working.
<img width="548" alt="image" src="https://github.com/openjdk/jmc/assets/803621/33eae156-ed88-4b5c-af97-55796ea48a6b">
For those interested I created a micronaut app from the launcher, and tweaked the gradle configuration.
graalvmNative {
toolchainDetection.set(false)
binaries {
named("main") {
// https://www.graalvm.org/22.0/reference-manual/native-image/JFR/
buildArgs(
"-H:+AllowVMInspection",
"-H:+PreserveFramePointer",
)
runtimeArgs(
"-XX:+FlightRecorder",
"-XX:StartFlightRecording=filename=recording.jfr",
)
}
}
}
-------------
PR Review: https://git.openjdk.org/jmc/pull/491#pullrequestreview-1487963451
PR Comment: https://git.openjdk.org/jmc/pull/491#issuecomment-1598625892
More information about the jmc-dev
mailing list