void CheckJvmtiError(jvmtiEnv* env, jvmtiError error) { if (error != JVMTI_ERROR_NONE) { char* error_name;
jvmtiError name_error = env->GetErrorName(error, &error_name); if (name_error != JVMTI_ERROR_NONE) {
LOG(FATAL) << "Unable to get error name for " << error;
}
LOG(FATAL) << "Unexpected error: " << error_name;
}
}
staticvoid JNICALL VMInitCallback([[maybe_unused]] jvmtiEnv* jenv,
JNIEnv* jni_env,
[[maybe_unused]] jthread thread) { // Set a breakpoint on a rare method that we won't expect to be hit. // java.lang.Thread.stop is deprecated and not expected to be used.
jclass cl = jni_env->FindClass("java/lang/Thread"); if (cl == nullptr) {
LOG(FATAL) << "Cannot find class java/lang/Thread to set a breakpoint";
}
jmethodID method = jni_env->GetMethodID(cl, "stop", "()V"); if (method == nullptr) {
LOG(FATAL) << "Cannot find method to set a breapoint";
}
// Set a callback for VM_INIT phase so we can set a breakpoint. We cannot just // set a breakpoint here since vm isn't fully initialized here.
jvmtiEventCallbacks callbacks;
memset(&callbacks, 0, sizeof(jvmtiEventCallbacks));
callbacks.VMInit = VMInitCallback;
CheckJvmtiError(jvmti_env, jvmti_env->SetEventCallbacks(&callbacks, sizeof(callbacks)));
CheckJvmtiError(jvmti_env,
jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr));
return0;
}
} // namespace art
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet am 2026-06-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.