Skip to content

Commit

Permalink
add JFR test proxy configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
roberttoyonaga authored and zakkak committed Aug 28, 2024
1 parent 9045610 commit 810bf87
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

import org.graalvm.nativeimage.ImageInfo;
import org.graalvm.nativeimage.hosted.Feature;
import org.graalvm.nativeimage.hosted.RuntimeProxyCreation;
import org.junit.After;
import org.junit.Assert;
import org.junit.BeforeClass;
Expand All @@ -54,6 +55,7 @@
import jdk.jfr.Configuration;
import jdk.jfr.consumer.RecordedEvent;
import jdk.jfr.consumer.RecordingFile;
import jdk.jfr.Unsigned;

/** Base class for JFR unit tests. */
public abstract class AbstractJfrTest {
Expand Down Expand Up @@ -196,4 +198,16 @@ public void afterRegistration(AfterRegistrationAccess access) {
*/
ModuleSupport.accessPackagesToClass(ModuleSupport.Access.OPEN, JfrTestFeature.class, false, "jdk.internal.vm.compiler", "org.graalvm.compiler.serviceprovider");
}

@Override
public void beforeAnalysis(BeforeAnalysisAccess access) {
/*
* Register proxies for event data assertion
*
* Unsigned added to be able to query RecordedObject.getLong() method, and this method
* checks if the value returned has the jdk.jfr.Unsigned. The jfr layer in HotSpot creates a
* proxy to query this information.
*/
RuntimeProxyCreation.register(Unsigned.class);
}
}

0 comments on commit 810bf87

Please sign in to comment.