Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JDK Flight Recorder support for Java native images #3018

Closed
adinn opened this issue Nov 23, 2020 · 4 comments
Closed

Add JDK Flight Recorder support for Java native images #3018

adinn opened this issue Nov 23, 2020 · 4 comments
Assignees
Labels

Comments

@adinn
Copy link
Collaborator

adinn commented Nov 23, 2020

Synopsis

This issue proposes to add JDK Flight Recorder (JFR) support for Java native images for monitoring and performance profiling of applications.

A prototype implementation is in progress, and work is ongoing to finalize the initial feature set for contribution to Graal CE. We welcome feedback from Oracle’s GraalVM team and the GraalVM community on both this proposal and the prototype implementation (which we will soon publish as a draft PR).

The prototype preserves and reuses existing Java APIs (jdk.jfr.*) together with a new Java-based implementation of the underlying system (currently under com.oracle.svm.core.jdk.jfr.*). This implementation closely resembles the native implementation in OpenJDK HotSpot (hotspot/share/jfr). Event instrumentation is forced during the analysis stage and reused in the resulting native image.

Proposed Initial Additions

  • Provide compile-time configuration to include or exclude the JFR infrastructure
  • Support existing OpenJDK API to start, stop and dump JFR v2.1 compliant recording files (.jfr) during native image run (jdk.jfr.Recording and related classes)
  • Allow command-line options to configure recordings on start-up, similar to the options in OpenJDK
  • Support build-time inclusion of application-defined events derived from jdk.jfr.Event and related classes
  • Emit OpenJDK Java specific events (Socket/File read/write, ExceptionThrown, etc.)

Proposed Long-Term Additions

  • Emit SubstrateVM specific events for memory allocation, garbage collection and other SubstrateVM subsystems
  • Support JFR crash dumps
  • Support leak profiling
  • Add Thread and Stack Trace data for events
  • Provide remote API to start, stop and dump recordings

Expected Benefits

  • Native image execution monitoring and tracing
  • Native image performance profiling via JFR file analysis
  • Existing Java users and applications can migrate to native image with JFR available

Limitations

  • No dynamic events created at runtime
@adinn adinn added the feature label Nov 23, 2020
@thegreystone
Copy link

Is support for the jdk.ExecutionSample event, or a true CPU profiling event, part of this effort?

@jiekang
Copy link
Collaborator

jiekang commented Nov 24, 2020

@thegreystone Support for jdk.ExecutionSample or similar is part of the overall effort but for a currently unknown future date.

@jerboaa
Copy link
Collaborator

jerboaa commented Dec 16, 2020

The WIP PR for this is here: #3070

@jiekang
Copy link
Collaborator

jiekang commented Sep 30, 2021

The initial support has made it into upstream via #3444

I think this issue can be closed as 'done'. There is more work to do to complete the implementation but those will be covered in separate, specific issues.

@jiekang jiekang closed this as completed Sep 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants