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

Erik Gahlin egahlin at openjdk.org
Wed Aug 2 08:21:59 UTC 2023


On Fri, 28 Jul 2023 09:38:13 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:
> 
>   add macro guards because the build errors in zero build

src/hotspot/os/bsd/os_bsd.cpp line 1027:

> 1025:   log_info(os)("attempting shared library load of %s", filename);
> 1026: 
> 1027: #if INCLUDE_JFR

We typically skip INCLUDE_JFR for events and rely on empty stubs in the code generation. This to make the code more easy to read.

src/hotspot/os/linux/os_linux.cpp line 1825:

> 1823: #if INCLUDE_JFR
> 1824:     event.set_success(true);
> 1825:     event.set_errorDescription("");

Use null if there is no error message

src/hotspot/share/jfr/metadata/metadata.xml line 942:

> 940:   </Event>
> 941: 
> 942:   <Event name="NativeLibraryLoad" category="Java Virtual Machine, Runtime" label="Native Library Load Operation" thread="false" stackTrace="true" startTime="true"

I think "Native Library Load" is sufficient as an event label and "Success" for the success field.

I think "error" is sufficient for the error field. We could use "errorMessage", if you believe there are other error related information we may want to add in the future.

The "name" label could changed to "Name", similar to the NativeLibrary event,

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

> 49: 
> 50:     public static void main(String[] args) throws Throwable {
> 51:         Recording recording = new Recording();

Use try-with-resources.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15065#discussion_r1277527396
PR Review Comment: https://git.openjdk.org/jdk/pull/15065#discussion_r1277523771
PR Review Comment: https://git.openjdk.org/jdk/pull/15065#discussion_r1277522273
PR Review Comment: https://git.openjdk.org/jdk/pull/15065#discussion_r1277528974


More information about the hotspot-jfr-dev mailing list