From 4142a8b2c582b77631996a7c826915b6bf864e57 Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Tue, 12 Nov 2024 18:28:19 +0100 Subject: [PATCH 1/2] Default to GetAllStacktraces sampler on J9 when 'cpu' event is specified --- ddprof-lib/src/main/cpp/profiler.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/ddprof-lib/src/main/cpp/profiler.cpp b/ddprof-lib/src/main/cpp/profiler.cpp index cf02e549..b538786e 100644 --- a/ddprof-lib/src/main/cpp/profiler.cpp +++ b/ddprof-lib/src/main/cpp/profiler.cpp @@ -1016,16 +1016,11 @@ Engine *Profiler::selectCpuEngine(Arguments &args) { return &noop_engine; } else if (args._cpu >= 0 || strcmp(args._event, EVENT_CPU) == 0) { if (VM::isOpenJ9()) { - if (!J9Ext::can_use_ASGCT()) { - if (!J9Ext::is_jvmti_jmethodid_safe()) { - Log::warn("Safe jmethodID access is not available on this JVM. Using " - "CPU profiler on your own risk."); - } - return &j9_engine; - } else if (!J9Ext::is_jmethodid_safe()) { + if (!J9Ext::is_jvmti_jmethodid_safe()) { Log::warn("Safe jmethodID access is not available on this JVM. Using " "CPU profiler on your own risk."); } + return &j9_engine; } return !ctimer.check(args) ? (Engine *)&ctimer From 7426d82f04cb1422d687d4fa3ad85d28733605d5 Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Tue, 12 Nov 2024 18:29:52 +0100 Subject: [PATCH 2/2] Default to GetAllStacktraces wallclock sampler on J9 when 'jvmti' is specified for wallclock --- ddprof-lib/src/main/cpp/profiler.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ddprof-lib/src/main/cpp/profiler.cpp b/ddprof-lib/src/main/cpp/profiler.cpp index b538786e..8eb0ff52 100644 --- a/ddprof-lib/src/main/cpp/profiler.cpp +++ b/ddprof-lib/src/main/cpp/profiler.cpp @@ -1043,16 +1043,15 @@ Engine *Profiler::selectWallEngine(Arguments &args) { return &noop_engine; } if (VM::isOpenJ9()) { - if (!J9Ext::can_use_ASGCT()) { + if (args._wallclock_sampler == JVMTI) { if (!J9Ext::is_jvmti_jmethodid_safe()) { Log::warn("Safe jmethodID access is not available on this JVM. Using " "wallclock profiler on your own risk."); } j9_engine.sampleIdleThreads(); return (Engine *)&j9_engine; - } else if (!J9Ext::is_jmethodid_safe()) { - Log::warn("Safe jmethodID access is not available on this JVM. Using " - "wallclock profiler on your own risk."); + } else { + return (Engine *)&wall_asgct_engine; } } switch (args._wallclock_sampler) {