use of jdk.jfr.Configuration in project graal by oracle.
the class Target_jdk_jfr_internal_jfc_JFC method createKnown.
@Substitute
public static Configuration createKnown(String name) throws IOException, ParseException {
// Check if this is a pre-parsed known configuration.
for (Configuration config : SubstrateJVM.getKnownConfigurations()) {
if (config.getName().equals(name)) {
return config;
}
}
// Assume path included in name
Path localPath = Paths.get(name);
String jfcName = JFC.nameFromPath(localPath);
try (Reader r = Files.newBufferedReader(localPath)) {
return Target_jdk_jfr_internal_jfc_JFCParser.createConfiguration(jfcName, r);
}
}
use of jdk.jfr.Configuration 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