use of com.oracle.svm.core.jfr.JfrManager in project graal by oracle.
the class JfrFeature method beforeAnalysis.
@Override
public void beforeAnalysis(Feature.BeforeAnalysisAccess access) {
RuntimeSupport runtime = RuntimeSupport.getRuntimeSupport();
JfrManager manager = JfrManager.get();
runtime.addStartupHook(manager.startupHook());
runtime.addShutdownHook(manager.shutdownHook());
Class<?> eventClass = access.findClassByName("jdk.internal.event.Event");
if (eventClass != null) {
access.registerSubtypeReachabilityHandler(JfrFeature::eventSubtypeReachable, eventClass);
}
}
use of com.oracle.svm.core.jfr.JfrManager in project graal by oracle.
the class JfrFeature method afterRegistration.
@Override
public void afterRegistration(AfterRegistrationAccess access) {
ModuleSupport.exportAndOpenAllPackagesToUnnamed("jdk.jfr", false);
ModuleSupport.exportAndOpenAllPackagesToUnnamed("java.base", false);
ModuleSupport.exportAndOpenPackageToClass("jdk.jfr", "jdk.jfr.events", false, JfrFeature.class);
ModuleSupport.exportAndOpenPackageToClass("jdk.internal.vm.ci", "jdk.vm.ci.hotspot", false, JfrEventSubstitution.class);
// Initialize some parts of JFR/JFC at image build time.
List<Configuration> knownConfigurations = JFC.getConfigurations();
JVM.getJVM().createNativeJFR();
ImageSingletons.add(JfrManager.class, new JfrManager(HOSTED_ENABLED));
ImageSingletons.add(SubstrateJVM.class, new SubstrateJVM(knownConfigurations));
ImageSingletons.add(JfrSerializerSupport.class, new JfrSerializerSupport());
ImageSingletons.add(JfrTraceIdMap.class, new JfrTraceIdMap());
ImageSingletons.add(JfrTraceIdEpoch.class, new JfrTraceIdEpoch());
ImageSingletons.add(JfrGCNames.class, new JfrGCNames());
JfrSerializerSupport.get().register(new JfrFrameTypeSerializer());
JfrSerializerSupport.get().register(new JfrThreadStateSerializer());
ThreadListenerSupport.get().register(SubstrateJVM.getThreadLocal());
if (HOSTED_ENABLED) {
RuntimeClassInitializationSupport rci = ImageSingletons.lookup(RuntimeClassInitializationSupport.class);
rci.initializeAtBuildTime("jdk.management.jfr", "Allow FlightRecorder to be used at image build time");
rci.initializeAtBuildTime("com.sun.jmx.mbeanserver", "Allow FlightRecorder to be used at image build time");
rci.initializeAtBuildTime("com.sun.jmx.defaults", "Allow FlightRecorder to be used at image build time");
rci.initializeAtBuildTime("java.beans", "Allow FlightRecorder to be used at image build time");
}
}
Aggregations