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

stack_collapse unit tests fail on Windows #173

Open
michaelwoerister opened this issue Aug 26, 2021 · 3 comments
Open

stack_collapse unit tests fail on Windows #173

michaelwoerister opened this issue Aug 26, 2021 · 3 comments

Comments

@michaelwoerister
Copy link
Member

michaelwoerister commented Aug 26, 2021

For some reason the unit tests in stack_collapse.rs fail on Windows (at least for me locally), even though they don't seem to contain anything platform specific.

cc @wesleywiser

@rylev
Copy link
Member

rylev commented Sep 10, 2021

Turns out the issue is that Windows SystemTime does not support time intervals smaller than 100 nanoseconds. The tests are using intervals much smaller than that and when we add a duration to system times that are smaller than 100 nanoseconds, you'll end up not actually adding any time (i.e., the system time you get after the addition is the same as the one before).

You can see where we divide nanoseconds into 100 nanosecond chunks in stdlib here.

To fix this we need to use a time mechanism that has more precision than 100 nanosecond intervals.

@michaelwoerister
Copy link
Member Author

@eddyb mentioned that a fix for this should also take care of the case when we are not actually dealing with timestamps, such as when recording instructions counts.

@eddyb
Copy link
Member

eddyb commented Oct 6, 2021

For generalized handling of counters, we've been serializing this as counter.units in the JSON:

Counter::WallTime(_) => (
WallTime::NAME,
r#"[["ns", 1], ["μs", 1000], ["ms", 1000000], ["s", 1000000000]]"#,
),
Counter::Instructions(_) => (Instructions::NAME, r#"[["instructions", 1]]"#),
Counter::InstructionsMinusIrqs(_) => {
(InstructionsMinusIrqs::NAME, r#"[["instructions", 1]]"#)
}
Counter::InstructionsMinusRaw0420(_) => {
(InstructionsMinusRaw0420::NAME, r#"[["instructions", 1]]"#)
}

So we should be able to pretty-print an u64 that measures nanoseconds, as the appropriate unit for a maximum number of "significant digits". It's just going to be annoying to thread that state through.

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

No branches or pull requests

3 participants