From 695065fc1c8b0477370ee51db64720f09fe3fd4c Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 14 Nov 2024 13:54:24 -0500 Subject: [PATCH] Standardize some of the profiler sampling frequencies --- .../com/datadog/profiling/ddprof/DatadogProfiler.java | 10 +++++++++- .../java/datadog/trace/api/config/ProfilingConfig.java | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dd-java-agent/agent-profiling/profiling-ddprof/src/main/java/com/datadog/profiling/ddprof/DatadogProfiler.java b/dd-java-agent/agent-profiling/profiling-ddprof/src/main/java/com/datadog/profiling/ddprof/DatadogProfiler.java index c4c49d82731..e3291517cd2 100644 --- a/dd-java-agent/agent-profiling/profiling-ddprof/src/main/java/com/datadog/profiling/ddprof/DatadogProfiler.java +++ b/dd-java-agent/agent-profiling/profiling-ddprof/src/main/java/com/datadog/profiling/ddprof/DatadogProfiler.java @@ -36,6 +36,7 @@ import com.datadog.profiling.utils.ProfilingMode; import com.datadoghq.profiler.ContextSetter; import com.datadoghq.profiler.JavaProfiler; +import datadog.trace.api.Platform; import datadog.trace.api.config.ProfilingConfig; import datadog.trace.api.profiling.RecordingData; import datadog.trace.bootstrap.config.provider.ConfigProvider; @@ -258,6 +259,8 @@ String cmdStartProfiling(Path file) throws IllegalStateException { } if (profilingModes.contains(CPU)) { // cpu profiling is enabled. + final int DEFAULT_J9_CPU_SAMPLING_FREQUENCY = 50; + String schedulingEvent = getSchedulingEvent(configProvider); if (schedulingEvent != null && !schedulingEvent.isEmpty()) { // using a user-specified event, e.g. L1-dcache-load-misses @@ -268,7 +271,12 @@ String cmdStartProfiling(Path file) throws IllegalStateException { } } else { // using cpu time schedule - cmd.append(",cpu=").append(getCpuInterval(configProvider)).append('m'); + cmd.append(",cpu=") + .append( + Platform.isJ9() + ? DEFAULT_J9_CPU_SAMPLING_FREQUENCY + : getCpuInterval(configProvider)) + .append('m'); } } if (profilingModes.contains(WALL)) { diff --git a/dd-trace-api/src/main/java/datadog/trace/api/config/ProfilingConfig.java b/dd-trace-api/src/main/java/datadog/trace/api/config/ProfilingConfig.java index 4d5c10f7fb1..0040858ff69 100644 --- a/dd-trace-api/src/main/java/datadog/trace/api/config/ProfilingConfig.java +++ b/dd-trace-api/src/main/java/datadog/trace/api/config/ProfilingConfig.java @@ -106,7 +106,7 @@ public final class ProfilingConfig { public static final boolean PROFILING_DATADOG_PROFILER_WALL_ENABLED_DEFAULT = true; public static final String PROFILING_DATADOG_PROFILER_WALL_INTERVAL = "profiling.ddprof.wall.interval.ms"; - public static final int PROFILING_DATADOG_PROFILER_WALL_INTERVAL_DEFAULT = 10; + public static final int PROFILING_DATADOG_PROFILER_WALL_INTERVAL_DEFAULT = 50; public static final String PROFILING_DATADOG_PROFILER_WALL_COLLAPSING = "profiling.ddprof.wall.collapsing";