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 Java-level JFR event tests and annotate JfrAdaptiveSampler methods with BasedOnJDKFile #8542

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

roberttoyonaga
Copy link
Collaborator

Summary:

  1. Add tests for Java-level JFR events.

These events we typically get "for free", but problems related to substitutions can result in them being emitted incorrectly, or not at all.

  1. Add @BasedOnJdkFile to throttler classes.

I'm not sure if its better to annotate each individual method, or simply the whole class. Will this annotation somehow alert us if the relevant code in the JDK changes, or is it just a form of documentation?

add @BasedOnJdkFile to throttler classes.
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Mar 8, 2024
@roberttoyonaga roberttoyonaga added native-image redhat-interest native-image-jfr and removed OCA Verified All contributors have signed the Oracle Contributor Agreement. labels Mar 8, 2024
@zapster
Copy link
Member

zapster commented Mar 11, 2024

I'm not sure if its better to annotate each individual method, or simply the whole class.

I guess it depends. Individual methods give us higher granularity, so if only one method changes this might be simpler to adopt. On the other hand, if all of the cpp file in the JDK is just related to the Java file in native image, a single one might be fine as well.

One thing we should keep in mind when adding these annotations: It should be clear what needs to be done if the referenced JDK code snippet changes. If the is not clear from the native image code alone, please add further comments.

Will this annotation somehow alert us if the relevant code in the JDK changes, or is it just a form of documentation?

There is no public utility yet that uses this information, but we are reviewing those annotation when updating to a new JDK version and take care that they stay up to date.

That said, this is a pretty new approach and we are still learning what works and what not. So with that in mind, I'd deal use this as computer readable documentation for now.

In that sense, your change is very much OK wrt to BasedOnJDKFile, thanks. Very much appreciated!

Copy link

Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
The following contributors of this PR have not signed the OCA:

To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application.

When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated.

If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. label Mar 11, 2024
Copy link

Thank you for signing the OCA.

@oracle-contributor-agreement oracle-contributor-agreement bot added OCA Verified All contributors have signed the Oracle Contributor Agreement. and removed OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. labels Mar 11, 2024
private static final long DEFAULT_WINDOW_LOOKBACK_COUNT = 25;
@BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-23+8/src/hotspot/share/jfr/recorder/service/jfrEventThrottler.cpp#L112-L113") //
Copy link
Member

@zapster zapster Apr 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the other two annotations for the constants above and below should use a single line reference. Currently they span two lines, see https://github.com/openjdk/jdk/blob/jdk-23+8/src/hotspot/share/jfr/recorder/service/jfrEventThrottler.cpp#L112-L113.

Suggested change
@BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-23+8/src/hotspot/share/jfr/recorder/service/jfrEventThrottler.cpp#L112-L113") //
@BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-23+8/src/hotspot/share/jfr/recorder/service/jfrEventThrottler.cpp#L112") //

Other annotations that should reference a single source line but use a range are probably affected as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I've updated the relevant annotations to point to a single line instead of a range. I needed up update the regex here too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah right. apparently, we did not yet use single line references. thanks for fixing.

Copy link
Member

@zapster zapster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good. I will integrate it asap.

@roberttoyonaga
Copy link
Collaborator Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
native-image native-image-jfr OCA Verified All contributors have signed the Oracle Contributor Agreement. redhat-interest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants