Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ddprof-lib/src/main/cpp/profiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ static inline int makeFrame(ASGCT_CallFrame *frames, jint type,

void Profiler::addJavaMethod(const void *address, int length,
jmethodID method) {
printf("Add compiled method: %ld\n", (long)method);
CodeHeap::updateBounds(address, (const char *)address + length);
}

Expand Down
5 changes: 5 additions & 0 deletions ddprof-lib/src/main/cpp/vmEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ bool VM::initProfilerBridge(JavaVM *vm, bool attach) {
capabilities.can_generate_compiled_method_load_events = 1;
capabilities.can_generate_monitor_events = 1;
capabilities.can_tag_objects = 1;
capabilities.can_generate_method_entry_events = 1;

_jvmti->AddCapabilities(&capabilities);

Expand All @@ -405,6 +406,8 @@ bool VM::initProfilerBridge(JavaVM *vm, bool attach) {
callbacks.SampledObjectAlloc = ObjectSampler::SampledObjectAlloc;
callbacks.GarbageCollectionFinish = LivenessTracker::GarbageCollectionFinish;
callbacks.NativeMethodBind = ddprof::VMStructs::NativeMethodBind;
callbacks.MethodEntry = MethodEntry;

_jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks));

_jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL);
Expand All @@ -415,6 +418,8 @@ bool VM::initProfilerBridge(JavaVM *vm, bool attach) {
JVMTI_EVENT_DYNAMIC_CODE_GENERATED, NULL);
_jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND,
NULL);
_jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, NULL);


if (hotspot_version() == 0 || !CodeHeap::available()) {
// Workaround for JDK-8173361: avoid CompiledMethodLoad events when possible
Expand Down
8 changes: 7 additions & 1 deletion ddprof-lib/src/main/cpp/vmEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,13 @@ class VM {

static void JNICALL ClassPrepare(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread,
jclass klass) {
loadMethodIDs(jvmti, jni, klass);
// loadMethodIDs(jvmti, jni, klass);
}

static void JNICALL MethodEntry(jvmtiEnv *jvmti_env,
JNIEnv* jni_env,
jthread thread,
jmethodID method) {
}

static jvmtiError JNICALL
Expand Down
Loading