Pin clock::ticks_from_counter with unit tests #584

Closed
opened 2026-11-28 10:15:16 +00:00 by AnastasisKon · 5 comments
AnastasisKon commented 2026-11-28 10:15:16 +00:00 (Migrated from github.com)
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T10:15:16Z.


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.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:6663256349 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/584). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T10:15:16Z. --- 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 commented 2026-11-28 10:15:19 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T10:15:19Z.


/claim

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7237776143 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/584#issuecomment-7237776143). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T10:15:19Z. --- /claim
github-actions[bot] commented 2026-11-28 10:15:28 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-28T10:15:28Z.


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

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7237777823 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/584#issuecomment-7237777823). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-28T10:15:28Z. --- Claimed by @AnastasisKon. Open a draft pull request with `Refs #584` in its description within 24 hours, or the claim expires.
AnastasisKon commented 2026-11-28 12:37:09 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T12:37:09Z.


/release - done: PR #585 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.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7239351583 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/584#issuecomment-7239351583). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T12:37:09Z. --- /release - done: PR #585 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.
github-actions[bot] commented 2026-11-28 12:37:17 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-28T12:37:17Z.


Released. This issue is free to claim.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7239353198 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/584#issuecomment-7239353198). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-28T12:37:17Z. --- Released. This issue is free to claim.
AnastasisKon commented 2026-11-28 17:05:58 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T17:05:58Z.


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

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7242752972 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/584#issuecomment-7242752972). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T17:05:58Z. --- The tests this asks for are in the tree already (the mapping, the FXSAVE accessors, the clock scaling and `normalise` are all pinned); closing.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
LakshanSivakumar/Native-Victory-macOS#584
No description provided.