RFR: JDK-8313251: Add NativeLibraryLoad event [v5]

David Holmes dholmes at openjdk.org
Thu Aug 3 07:24:34 UTC 2023


On Wed, 2 Aug 2023 13:00:20 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

>> Add a NativeLibraryLoad event that provides us more detail about shared lib/dll loads. This gives a time stamp and success + error details of the load operation. It enhances the already existing information we get from the existing NativeLibrary event (that periodically samples the native modules of the jvm process).
>
> Matthias Baesken has updated the pull request incrementally with one additional commit since the last revision:
> 
>   use try with resources in test

Overall looks okay but I have a request for the test. Thanks.

test/jdk/jdk/jfr/event/runtime/TestNativeLibraryLoadEvent.java line 54:

> 52:             recording.enable(EVENT_NAME);
> 53:             recording.start();
> 54:             System.loadLibrary("awt");

I don't think loading libawt is a good choice - maybe libnet or libnio? Headless builds may not have libawt and I'd be concerned about loading it directly and running the OnLoad hooks.

test/jdk/jdk/jfr/event/runtime/TestNativeLibraryLoadEvent.java line 77:

> 75:             libTemplate = "%s.dll";
> 76:         } else if (Platform.isOSX()) {
> 77:             libTemplate = "lib%s.dylib";

We have `Platform.sharedLibraryExt()` to simplify this a bit. Unfortunately we don't have a `sharedLibraryPrefix()` to reduce it to one line. :(

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

Changes requested by dholmes (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/15065#pullrequestreview-1560383181
PR Review Comment: https://git.openjdk.org/jdk/pull/15065#discussion_r1282758846
PR Review Comment: https://git.openjdk.org/jdk/pull/15065#discussion_r1282754561


More information about the hotspot-jfr-dev mailing list