feat(profiler): wall-clock signal suppression for idle threads by kaahos · Pull Request #560 · DataDog/java-profiler · GitHub
Skip to content

feat(profiler): wall-clock signal suppression for idle threads#560

Merged
kaahos merged 30 commits into
mainfrom
paul.fournillon/wallclock-suppression
Jun 26, 2026
Merged

feat(profiler): wall-clock signal suppression for idle threads#560
kaahos merged 30 commits into
mainfrom
paul.fournillon/wallclock-suppression

Conversation

@kaahos

@kaahos kaahos commented May 29, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?:

Before sending SIGVTALRM, the wall-clock timer checks whether the target thread is already in a skippable OS state and has already produced a sample during this blocking run. If so, the signal is suppressed. The first sample of every blocking run is always collected.

Motivation:

High-frequency wall-clock sampling on threads spending most of their time idle generates many redundant samples of identical stacks at high CPU cost. The precheck lets us emit one representative sample per blocking run and skip the rest, recovering signal throughput for threads that are actually running.

This is the first of two PRs splitting paul.fournillon/wallclock_precheck. This PR ships the suppression infrastructure. The follow-up PR adds datadog.TaskBlock event recording.

Additional Notes:

How to test the change?:

New unit tests:

  • ddprof-lib/src/test/cpp/park_state_ut.cpp
  • ddprof-lib/src/test/cpp/wallprecheck_args_ut.cpp

New integration tests:

  • PrecheckTest: verifies suppression fires and reduces signal count.
  • PrecheckEfficiencyTest: measures overhead reduction under sustained park.
  • WallclockMitigationsCombinedTest: end-to-end combined mitigations scenario.

Run locally with:
./gradlew :ddprof-test:test --tests '*Precheck*' --tests '*WallclockMitigations*' --tests '*WallclockTimer*'

For Datadog employees:

  • If this PR touches code that signs or publishes builds or packages, or handles
    credentials of any kind, I've requested a review from @DataDog/security-design-and-guidance.
  • This PR doesn't touch any of that.
  • JIRA: [JIRA-14354]

Unsure? Have a question? Request a review!

@datadog-prod-us1-5

datadog-prod-us1-5 Bot commented May 29, 2026

Copy link
Copy Markdown

@kaahos kaahos changed the title Paul.fournillon/wallclock suppression feat(profiler): wall-clock signal suppression for sleeping/parked threads May 29, 2026
@dd-octo-sts

dd-octo-sts Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

CI Test Results

Run: #28086338511 | Commit: 5ae5208 | Duration: 12m 59s (longest job)

5 of 32 test jobs failed

Status Overview

JDK glibc-aarch64/debug glibc-amd64/debug musl-aarch64/debug musl-amd64/debug
8 - - -
8-ibm - - -
8-j9 - -
8-librca - -
8-orcl - - -
11 - - -
11-j9 - -
11-librca - -
17 - -
17-graal - -
17-j9 - -
17-librca - -
21 - -
21-graal - -
21-librca - -
25 - -
25-graal - -
25-librca - -

Legend: ✅ passed | ❌ failed | ⚪ skipped | 🚫 cancelled

Failed Tests

musl-aarch64/debug / 21-librca

Job: View logs

No detailed failure information available. Check the job logs.

musl-aarch64/debug / 11-librca

Job: View logs

No detailed failure information available. Check the job logs.

musl-aarch64/debug / 25-librca

Job: View logs

No detailed failure information available. Check the job logs.

musl-aarch64/debug / 17-librca

Job: View logs

No detailed failure information available. Check the job logs.

musl-aarch64/debug / 8-librca

Job: View logs

No detailed failure information available. Check the job logs.

Summary: Total: 32 | Passed: 27 | Failed: 5


Updated: 2026-06-24 08:59:15 UTC

@kaahos kaahos force-pushed the paul.fournillon/wallclock-suppression branch 5 times, most recently from 3f4fe1e to bcf405b Compare May 29, 2026 13:22
@kaahos kaahos force-pushed the paul.fournillon/wallclock-suppression branch from bcf405b to b1cb73f Compare May 29, 2026 13:39
Copilot finished work on behalf of kaahos May 29, 2026 15:57
@kaahos

kaahos commented May 29, 2026

Copy link
Copy Markdown
Contributor Author

@copilot review this PR

Copilot AI commented May 29, 2026

Copy link
Copy Markdown
Contributor

@copilot review this PR

Reviewed the changes; no blocking issues found in the wall-clock precheck logic or tests.

Copilot finished work on behalf of kaahos May 29, 2026 16:19
@kaahos kaahos marked this pull request as ready for review June 1, 2026 13:49
@kaahos kaahos requested a review from a team as a code owner June 1, 2026 13:49
@kaahos kaahos changed the title feat(profiler): wall-clock signal suppression for sleeping/parked threads feat(profiler): wall-clock signal suppression for idle threads Jun 1, 2026
@kaahos

kaahos commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

@copilot review this PR.

@kaahos

kaahos commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

most of the previous comments have been addressed @jbachorik! The branch now also includes the new features coming from main.

@rkennke rkennke left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice improvement! I have some questions...

Comment thread ddprof-lib/src/main/cpp/threadFilter.h Outdated
Comment thread ddprof-lib/src/main/cpp/thread.h Outdated
Comment thread ddprof-lib/src/main/cpp/livenessTracker.cpp
Comment thread ddprof-lib/src/main/cpp/hotspot/vmStructs.inline.h Outdated
Comment thread ddprof-lib/src/main/cpp/hotspot/vmStructs.inline.h Outdated
@kaahos kaahos force-pushed the paul.fournillon/wallclock-suppression branch from 0940fbe to 3df9af6 Compare June 19, 2026 09:22
@kaahos kaahos requested a review from rkennke June 19, 2026 11:18

@rkennke rkennke left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two follow-up accuracy/design questions on the weighted-sampling logic (not blockers). Thanks for addressing all my earlier points thoroughly.

Comment thread ddprof-lib/src/main/cpp/wallClock.cpp Outdated
Comment thread ddprof-lib/src/main/cpp/wallClock.cpp
@kaahos kaahos requested a review from rkennke June 23, 2026 16:31
@dd-octo-sts

dd-octo-sts Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

@rkennke rkennke left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making the changes. The CI failures appear to be infra issues (failure to upload artifacts). Good to go! Thanks!

@kaahos kaahos merged commit 6680cf5 into main Jun 26, 2026
100 of 105 checks passed
@kaahos kaahos deleted the paul.fournillon/wallclock-suppression branch June 26, 2026 14:37
@github-actions github-actions Bot added this to the 1.46.0 milestone Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants