use of com.oracle.svm.core.jfr.SubstrateJVM in project graal by oracle.
the class ThreadStartEvent method emit.
@Uninterruptible(reason = "Accesses a JFR buffer.")
public static void emit(IsolateThread isolateThread) {
SubstrateJVM svm = SubstrateJVM.get();
if (SubstrateJVM.isRecording() && svm.isEnabled(JfrEvent.ThreadStart)) {
JfrNativeEventWriterData data = StackValue.get(JfrNativeEventWriterData.class);
JfrNativeEventWriterDataAccess.initializeThreadLocalNativeBuffer(data);
JfrNativeEventWriter.beginEventWrite(data, false);
JfrNativeEventWriter.putLong(data, JfrEvent.ThreadStart.getId());
JfrNativeEventWriter.putLong(data, JfrTicks.elapsedTicks());
JfrNativeEventWriter.putEventThread(data);
JfrNativeEventWriter.putLong(data, svm.getStackTraceId(JfrEvent.ThreadStart.getId(), 0));
JfrNativeEventWriter.putThread(data, isolateThread);
JfrNativeEventWriter.putLong(data, SubstrateJVM.getParentThreadId(isolateThread));
JfrNativeEventWriter.endEventWrite(data, false);
}
}
use of com.oracle.svm.core.jfr.SubstrateJVM 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");
}
}
use of com.oracle.svm.core.jfr.SubstrateJVM in project graal by oracle.
the class ExecutionSampleEvent method writeExecutionSample.
@Uninterruptible(reason = "Accesses a JFR buffer.")
public static void writeExecutionSample(IsolateThread isolateThread, Thread.State threadState) {
SubstrateJVM svm = SubstrateJVM.get();
if (SubstrateJVM.isRecording() && svm.isEnabled(JfrEvent.ExecutionSample)) {
JfrNativeEventWriterData data = StackValue.get(JfrNativeEventWriterData.class);
JfrNativeEventWriterDataAccess.initializeThreadLocalNativeBuffer(data);
JfrNativeEventWriter.beginEventWrite(data, false);
JfrNativeEventWriter.putLong(data, JfrEvent.ExecutionSample.getId());
JfrNativeEventWriter.putLong(data, JfrTicks.elapsedTicks());
JfrNativeEventWriter.putThread(data, isolateThread);
JfrNativeEventWriter.putLong(data, svm.getStackTraceId(JfrEvent.ExecutionSample.getId(), 0));
JfrNativeEventWriter.putLong(data, JfrThreadState.getId(threadState));
JfrNativeEventWriter.endEventWrite(data, false);
}
}
Aggregations