Pin clock::ticks_from_counter with unit tests #588

Closed
opened 2026-11-28 10:17:16 +00:00 by github-bot · 5 comments
Owner

@⁠AnastasisKon on GitHub · 2026-11-28 10:15 UTC · original

Step toward steadier host timing on the native path.

crates/victory-gpu/src/clock.rs has ticks_from_counter(count, frequency) with no tests: the u128 multiply/divide against counter_frequency() (1e9 on posix) and the saturation at u64::MAX are unpinned.

Add unit tests covering: zero count, exact scaling at frequency == counter_frequency(), rounding down for non-divisible products, and saturation for huge counts. No behaviour change.

**@⁠AnastasisKon** on GitHub · 2026-11-28 10:15 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/584) Step toward steadier host timing on the native path. `crates/victory-gpu/src/clock.rs` has `ticks_from_counter(count, frequency)` with no tests: the u128 multiply/divide against `counter_frequency()` (1e9 on posix) and the saturation at `u64::MAX` are unpinned. Add unit tests covering: zero count, exact scaling at frequency == counter_frequency(), rounding down for non-divisible products, and saturation for huge counts. No behaviour change.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 10:17:16 +00:00
Author
Owner

@⁠AnastasisKon on GitHub · 2026-11-28 10:15 UTC · original

/claim

**@⁠AnastasisKon** on GitHub · 2026-11-28 10:15 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/584#issuecomment-7237776143) /claim
Author
Owner

@⁠github-actions[bot] on GitHub · 2026-11-28 10:15 UTC · original

Claimed by @⁠AnastasisKon. Open a draft pull request with Refs #584 in its description within 24 hours, or the claim expires.

**@⁠github-actions[bot]** on GitHub · 2026-11-28 10:15 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/584#issuecomment-7237777823) Claimed by @⁠AnastasisKon. Open a draft pull request with `Refs #584` in its description within 24 hours, or the claim expires.
Author
Owner

@⁠AnastasisKon on GitHub · 2026-11-28 12:37 UTC · original

/release - done: PR #589 pins clock::ticks_from_counter and ticks with unit tests. Carried in my fork's main (AnastasisKon/Native-Victory-macOS @ 69146296) with the full gate green (tests, clippy for Windows -D warnings, cargo xtask policy). Nothing merges upstream while the port is paused, so freeing the queue rather than holding a claim nobody can act on.

**@⁠AnastasisKon** on GitHub · 2026-11-28 12:37 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/584#issuecomment-7239351583) /release - done: PR #589 pins `clock::ticks_from_counter` and `ticks` with unit tests. Carried in my fork's `main` (AnastasisKon/Native-Victory-macOS @ 69146296) with the full gate green (tests, clippy for Windows -D warnings, `cargo xtask policy`). Nothing merges upstream while the port is paused, so freeing the queue rather than holding a claim nobody can act on.
Author
Owner

@⁠github-actions[bot] on GitHub · 2026-11-28 12:37 UTC · original

Released. This issue is free to claim.

**@⁠github-actions[bot]** on GitHub · 2026-11-28 12:37 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/584#issuecomment-7239353198) Released. This issue is free to claim.
Author
Owner

@⁠AnastasisKon on GitHub · 2026-11-28 17:05 UTC · original

The tests this asks for are in the tree already (the mapping, the FXSAVE accessors, the clock scaling and normalise are all pinned); closing.

**@⁠AnastasisKon** on GitHub · 2026-11-28 17:05 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/584#issuecomment-7242752972) The tests this asks for are in the tree already (the mapping, the FXSAVE accessors, the clock scaling and `normalise` are all pinned); closing.
This discussion has been locked. Commenting is limited to contributors.
No description provided.