Skip to content

Gate disabled profiler timers and accumulate CCD timing - #1064

Open
matthew-walters wants to merge 1 commit into
dimforge:masterfrom
matthew-walters:fix-1051-profiler-counters
Open

matthew-walters wants to merge 1 commit into
dimforge:masterfrom
matthew-walters:fix-1051-profiler-counters

Conversation

@matthew-walters

Copy link
Copy Markdown

Fixes #1051.

With the profiler feature enabled, pipeline timers called Instant::now() even after Counters::disable(). The enabled flag guarded the counter helper methods, but several pipeline stages accessed their timers directly.

Timers now track whether they are disabled. Counters::enable() and disable() update every timer, and Counters::reset() synchronizes timer state for compatibility with callers that modify the public enabled field directly. Disabling a running timer discards its open interval, so time spent disabled is not charged after re-enabling.

The CCD time-of-impact timer now resumes for each internal clamp pass instead of restarting. Because Counters::reset() clears it at the beginning of the outer step, it now accumulates timing across all CCD substeps.

The regressions verify that:

  • direct timer operations are inert while counters are disabled
  • disabling and re-enabling does not include the disabled interval
  • direct changes to Counters::enabled take effect on the next pipeline step
  • CCD timing includes injected work from multiple clamp passes

All three new regressions fail on the unpatched upstream revision and pass with this change.

Validation:

  • cargo test -p rapier3d --features profiler --test pipeline_counters
  • cargo test -p rapier3d --test pipeline_counters
  • cargo test -p rapier2d --features profiler --lib
  • RUSTFLAGS="-D warnings" cargo clippy -p rapier2d -p rapier3d --features profiler
  • RUSTFLAGS="-D warnings" cargo clippy -p rapier3d --features profiler --test pipeline_counters
  • cargo fmt --all -- --check
  • git diff --check

This branch has not been deployed

No deployments
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.

Profiler timers read the clock while Counters is disabled, and the CCD timer keeps only the last substep

1 participant