use of com.oracle.svm.core.jfr.JfrNativeEventWriterData in project graal by oracle.
the class JfrGCEventFeature method emitGCPhasePauseEvent.
@Uninterruptible(reason = "Accesses a JFR buffer.")
public void emitGCPhasePauseEvent(UnsignedWord gcEpoch, String name, long startTicks) {
int level = popPhase();
JfrEvent event = getGCPhasePauseEvent(level);
if (SubstrateJVM.isRecording() && SubstrateJVM.get().isEnabled(event)) {
long end = JfrTicks.elapsedTicks();
JfrNativeEventWriterData data = StackValue.get(JfrNativeEventWriterData.class);
JfrNativeEventWriterDataAccess.initializeThreadLocalNativeBuffer(data);
JfrNativeEventWriter.beginEventWrite(data, false);
JfrNativeEventWriter.putLong(data, event.getId());
JfrNativeEventWriter.putLong(data, startTicks);
JfrNativeEventWriter.putLong(data, end - startTicks);
JfrNativeEventWriter.putEventThread(data);
JfrNativeEventWriter.putLong(data, gcEpoch.rawValue());
JfrNativeEventWriter.putString(data, name);
JfrNativeEventWriter.endEventWrite(data, false);
}
}
use of com.oracle.svm.core.jfr.JfrNativeEventWriterData in project graal by oracle.
the class EndChunkNativePeriodicEvents method emitInitialSystemProperties.
@Uninterruptible(reason = "Accesses a JFR buffer.")
private static void emitInitialSystemProperties(StringEntry[] systemProperties) {
if (SubstrateJVM.isRecording() && SubstrateJVM.get().isEnabled(JfrEvent.InitialSystemProperty)) {
JfrNativeEventWriterData data = StackValue.get(JfrNativeEventWriterData.class);
JfrNativeEventWriterDataAccess.initializeThreadLocalNativeBuffer(data);
for (StringEntry systemProperty : systemProperties) {
JfrNativeEventWriter.beginEventWrite(data, false);
JfrNativeEventWriter.putLong(data, JfrEvent.InitialSystemProperty.getId());
JfrNativeEventWriter.putLong(data, JfrTicks.elapsedTicks());
JfrNativeEventWriter.putString(data, systemProperty.key);
JfrNativeEventWriter.putString(data, systemProperty.value);
JfrNativeEventWriter.endEventWrite(data, false);
}
}
}
use of com.oracle.svm.core.jfr.JfrNativeEventWriterData in project graal by oracle.
the class EndChunkNativePeriodicEvents method emitClassLoadingStatistics.
@Uninterruptible(reason = "Accesses a JFR buffer.")
private static void emitClassLoadingStatistics(long loadedClassCount, long unloadedClassCount) {
if (SubstrateJVM.isRecording() && SubstrateJVM.get().isEnabled(JfrEvent.ClassLoadingStatistics)) {
JfrNativeEventWriterData data = StackValue.get(JfrNativeEventWriterData.class);
JfrNativeEventWriterDataAccess.initializeThreadLocalNativeBuffer(data);
JfrNativeEventWriter.beginEventWrite(data, false);
JfrNativeEventWriter.putLong(data, JfrEvent.ClassLoadingStatistics.getId());
JfrNativeEventWriter.putLong(data, JfrTicks.elapsedTicks());
JfrNativeEventWriter.putLong(data, loadedClassCount);
JfrNativeEventWriter.putLong(data, unloadedClassCount);
JfrNativeEventWriter.endEventWrite(data, false);
}
}
use of com.oracle.svm.core.jfr.JfrNativeEventWriterData in project graal by oracle.
the class SafepointBeginEvent method emit.
/**
* HotSpot reports the number of Java threads, so we do the same. In our case that includes the
* VM operation thread. This is a major difference to HotSpot but affects other JFR areas as
* well.
*/
@Uninterruptible(reason = "Accesses a JFR buffer.")
public static void emit(UnsignedWord safepointId, int numJavaThreads, long startTicks) {
if (!HasJfrSupport.get()) {
return;
}
if (SubstrateJVM.isRecording() && SubstrateJVM.get().isEnabled(JfrEvent.SafepointBegin)) {
JfrNativeEventWriterData data = StackValue.get(JfrNativeEventWriterData.class);
JfrNativeEventWriterDataAccess.initializeThreadLocalNativeBuffer(data);
JfrNativeEventWriter.beginEventWrite(data, false);
JfrNativeEventWriter.putLong(data, JfrEvent.SafepointBegin.getId());
JfrNativeEventWriter.putLong(data, startTicks);
JfrNativeEventWriter.putLong(data, JfrTicks.elapsedTicks() - startTicks);
JfrNativeEventWriter.putEventThread(data);
JfrNativeEventWriter.putLong(data, safepointId.rawValue());
JfrNativeEventWriter.putInt(data, numJavaThreads);
// jniCriticalThreadCount
JfrNativeEventWriter.putInt(data, 0);
JfrNativeEventWriter.endEventWrite(data, false);
}
}
use of com.oracle.svm.core.jfr.JfrNativeEventWriterData in project graal by oracle.
the class ThreadEndEvent method emit.
@Uninterruptible(reason = "Accesses a JFR buffer.")
public static void emit(IsolateThread isolateThread) {
if (SubstrateJVM.isRecording() && SubstrateJVM.get().isEnabled(JfrEvent.ThreadEnd)) {
JfrNativeEventWriterData data = StackValue.get(JfrNativeEventWriterData.class);
JfrNativeEventWriterDataAccess.initializeThreadLocalNativeBuffer(data);
JfrNativeEventWriter.beginEventWrite(data, false);
JfrNativeEventWriter.putLong(data, JfrEvent.ThreadEnd.getId());
JfrNativeEventWriter.putLong(data, JfrTicks.elapsedTicks());
JfrNativeEventWriter.putEventThread(data);
JfrNativeEventWriter.putThread(data, isolateThread);
JfrNativeEventWriter.endEventWrite(data, false);
}
}
Aggregations