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

time-with-isolation test is drifting and often confuses people #3377

Closed
saethlin opened this issue Mar 14, 2024 · 0 comments · Fixed by #3379
Closed

time-with-isolation test is drifting and often confuses people #3377

saethlin opened this issue Mar 14, 2024 · 0 comments · Fixed by #3379

Comments

@saethlin
Copy link
Member

On my machine, with a silly for _ in 0..100_000 {}, the isolated clock already runs at about half the speed of the actual clock. That's probably somewhat tolerable, but rust-lang/rust#122420 is going to push us farther away from reality.

We might want to re-calibrate this magic value:

miri/src/clock.rs

Lines 4 to 9 in b228407

/// When using a virtual clock, this defines how many nanoseconds we pretend are passing for each
/// basic block.
/// This number is pretty random, but it has been shown to approximately cause
/// some sample programs to run within an order of magnitude of real time on desktop CPUs.
/// (See `tests/pass/shims/time-with-isolation*.rs`.)
const NANOSECONDS_PER_BASIC_BLOCK: u64 = 5000;

Or if our goal is really just an order of magnitude, we should make the test failure a lot more clear so reviewers/contributors are less confused by it.

@bors bors closed this as completed in 1fd2315 Mar 14, 2024
RalfJung pushed a commit to RalfJung/rust that referenced this issue Mar 15, 2024
explain time-with-isolation test better

Fixes rust-lang/miri#3377

`@saethlin` do you think this is better?
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 a pull request may close this issue.

1 participant