Skip to content

Commit 91bfec8

Browse files
committed
Do not force-disable TLAB allocation events on JDK 8
1 parent 9846976 commit 91bfec8

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

dd-java-agent/agent-profiling/profiling-controller-openjdk/src/main/java/com/datadog/profiling/controller/openjdk/OpenJdkController.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ && isEventEnabled(recordingSettings, "jdk.NativeMethodSample")) {
265265

266266
// Register periodic events
267267
AvailableProcessorCoresEvent.register();
268+
269+
log.debug("JFR Recording Settings: {}", recordingSettings);
268270
}
269271

270272
private static String getJfrRepositoryBase(ConfigProvider configProvider) {

dd-java-agent/agent-profiling/profiling-ddprof/src/main/java/com/datadog/profiling/ddprof/DatadogProfilerConfig.java

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -172,19 +172,23 @@ private static boolean isJmethodIDSafe() {
172172
}
173173

174174
public static boolean isAllocationProfilingEnabled(ConfigProvider configProvider) {
175-
boolean dflt = isJmethodIDSafe();
176-
boolean enableDdprofAlloc =
177-
getBoolean(
178-
configProvider,
179-
PROFILING_ALLOCATION_ENABLED,
180-
dflt,
181-
PROFILING_DATADOG_PROFILER_ALLOC_ENABLED);
182-
183-
if (!dflt && enableDdprofAlloc) {
184-
log.warn(
185-
"Allocation profiling was enabled although it is not considered stable on this JVM version.");
175+
// JVMTI Allocation Sampler is available since Java 11
176+
if (Platform.isJavaVersionAtLeast(11)) {
177+
boolean dflt = isJmethodIDSafe();
178+
boolean enableDdprofAlloc =
179+
getBoolean(
180+
configProvider,
181+
PROFILING_ALLOCATION_ENABLED,
182+
dflt,
183+
PROFILING_DATADOG_PROFILER_ALLOC_ENABLED);
184+
185+
if (!dflt && enableDdprofAlloc) {
186+
log.warn(
187+
"Allocation profiling was enabled although it is not considered stable on this JVM version.");
188+
}
189+
return enableDdprofAlloc;
186190
}
187-
return enableDdprofAlloc;
191+
return false;
188192
}
189193

190194
public static boolean isAllocationProfilingEnabled() {

0 commit comments

Comments
 (0)