Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow enabling experimental JVMTI wallclock sampler #7641

Merged
merged 1 commit into from
Sep 19, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import static com.datadog.profiling.ddprof.DatadogProfilerConfig.isTrackingGenerations;
import static com.datadog.profiling.ddprof.DatadogProfilerConfig.isWallClockProfilerEnabled;
import static com.datadog.profiling.ddprof.DatadogProfilerConfig.omitLineNumbers;
import static com.datadog.profiling.ddprof.DatadogProfilerConfig.useJvmtiWallclockSampler;
import static com.datadog.profiling.utils.ProfilingMode.ALLOCATION;
import static com.datadog.profiling.utils.ProfilingMode.CPU;
import static com.datadog.profiling.utils.ProfilingMode.MEMLEAK;
Expand Down Expand Up @@ -271,6 +272,9 @@ String cmdStartProfiling(Path file) throws IllegalStateException {
if (getWallContextFilter(configProvider)) {
cmd.append(",filter=0");
}
if (useJvmtiWallclockSampler(configProvider)) {
cmd.append(",wallsampler=jvmti");
}
}
cmd.append(",loglevel=").append(getLogLevel(configProvider));
if (profilingModes.contains(ALLOCATION) || profilingModes.contains(MEMLEAK)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
import static datadog.trace.api.config.ProfilingConfig.PROFILING_DATADOG_PROFILER_WALL_ENABLED;
import static datadog.trace.api.config.ProfilingConfig.PROFILING_DATADOG_PROFILER_WALL_INTERVAL;
import static datadog.trace.api.config.ProfilingConfig.PROFILING_DATADOG_PROFILER_WALL_INTERVAL_DEFAULT;
import static datadog.trace.api.config.ProfilingConfig.PROFILING_DATADOG_PROFILER_WALL_JVMTI;
import static datadog.trace.api.config.ProfilingConfig.PROFILING_DATADOG_PROFILER_WALL_JVMTI_DEFAULT;
import static datadog.trace.api.config.ProfilingConfig.PROFILING_HEAP_TRACK_GENERATIONS;
import static datadog.trace.api.config.ProfilingConfig.PROFILING_HEAP_TRACK_GENERATIONS_DEFAULT;
import static datadog.trace.api.config.ProfilingConfig.PROFILING_QUEUEING_TIME_ENABLED;
Expand Down Expand Up @@ -409,6 +411,14 @@ public static long getLong(ConfigProvider configProvider, String key) {
return configProvider.getLong(key, configProvider.getLong(normalizeKey(key), -1));
}

public static boolean useJvmtiWallclockSampler(ConfigProvider configProvider) {
return !isWallClockProfilerEnabled(configProvider)
&& getBoolean(
configProvider,
PROFILING_DATADOG_PROFILER_WALL_JVMTI,
PROFILING_DATADOG_PROFILER_WALL_JVMTI_DEFAULT);
}

private static String normalizeKey(String key) {
return key.replace(".ddprof.", ".async.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ public final class ProfilingConfig {
"profiling.ddprof.wall.context.filter";
public static final boolean PROFILING_DATADOG_PROFILER_WALL_CONTEXT_FILTER_DEFAULT = true;

public static final String PROFILING_DATADOG_PROFILER_WALL_JVMTI =
"profiling.experimental.ddprof.wall.jvmti";
public static final boolean PROFILING_DATADOG_PROFILER_WALL_JVMTI_DEFAULT = false;

public static final String PROFILING_DATADOG_PROFILER_SCHEDULING_EVENT =
"profiling.experimental.ddprof.scheduling.event";

Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ moshi = '1.11.0'
testcontainers = '1.19.3'
jmc = "8.1.0"
autoservice = "1.0-rc7"
ddprof = "1.13.0"
ddprof = "1.14.0"
asm = "9.7"
cafe_crypto = "0.1.0"
lz4 = "1.7.1"
Expand Down