Search in sources :

Example 1 with SubstrateJVM

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);
    }
}
Also used : JfrNativeEventWriterData(com.oracle.svm.core.jfr.JfrNativeEventWriterData) SubstrateJVM(com.oracle.svm.core.jfr.SubstrateJVM) Uninterruptible(com.oracle.svm.core.annotate.Uninterruptible)

Example 2 with SubstrateJVM

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");
    }
}
Also used : JfrManager(com.oracle.svm.core.jfr.JfrManager) Configuration(jdk.jfr.Configuration) JfrSerializerSupport(com.oracle.svm.core.jfr.JfrSerializerSupport) JfrThreadStateSerializer(com.oracle.svm.core.jfr.JfrThreadStateSerializer) JfrFrameTypeSerializer(com.oracle.svm.core.jfr.JfrFrameTypeSerializer) RuntimeClassInitializationSupport(org.graalvm.nativeimage.impl.RuntimeClassInitializationSupport) JfrGCNames(com.oracle.svm.core.jfr.JfrGCNames) JfrTraceIdMap(com.oracle.svm.core.jfr.traceid.JfrTraceIdMap) JfrTraceIdEpoch(com.oracle.svm.core.jfr.traceid.JfrTraceIdEpoch) SubstrateJVM(com.oracle.svm.core.jfr.SubstrateJVM)

Example 3 with SubstrateJVM

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);
    }
}
Also used : JfrNativeEventWriterData(com.oracle.svm.core.jfr.JfrNativeEventWriterData) SubstrateJVM(com.oracle.svm.core.jfr.SubstrateJVM) Uninterruptible(com.oracle.svm.core.annotate.Uninterruptible)

Aggregations

SubstrateJVM (com.oracle.svm.core.jfr.SubstrateJVM)3 Uninterruptible (com.oracle.svm.core.annotate.Uninterruptible)2 JfrNativeEventWriterData (com.oracle.svm.core.jfr.JfrNativeEventWriterData)2 JfrFrameTypeSerializer (com.oracle.svm.core.jfr.JfrFrameTypeSerializer)1 JfrGCNames (com.oracle.svm.core.jfr.JfrGCNames)1 JfrManager (com.oracle.svm.core.jfr.JfrManager)1 JfrSerializerSupport (com.oracle.svm.core.jfr.JfrSerializerSupport)1 JfrThreadStateSerializer (com.oracle.svm.core.jfr.JfrThreadStateSerializer)1 JfrTraceIdEpoch (com.oracle.svm.core.jfr.traceid.JfrTraceIdEpoch)1 JfrTraceIdMap (com.oracle.svm.core.jfr.traceid.JfrTraceIdMap)1 Configuration (jdk.jfr.Configuration)1 RuntimeClassInitializationSupport (org.graalvm.nativeimage.impl.RuntimeClassInitializationSupport)1