diff --git a/ddprof-lib/src/main/cpp/profiler.cpp b/ddprof-lib/src/main/cpp/profiler.cpp index cf02e549..8eb0ff52 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 @@ -1048,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) {