Skip to content

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

@saethlin

Description

@saethlin

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions