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

Fix self profiler ICE on Windows #56170

Merged
merged 2 commits into from Nov 25, 2018

Conversation

Projects
None yet
6 participants
@wesleywiser
Member

wesleywiser commented Nov 22, 2018

Fixes #51648

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Nov 22, 2018

r? @pnkfelix

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive

This comment was marked as resolved.

Collaborator

rust-highfive commented Nov 22, 2018

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:06181f6d:start=1542910651068563798,finish=1542910652219717647,duration=1151153849
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#Pull-Requests-and-Security-Restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-5.0
---
[00:05:47]    Compiling syntax_pos v0.0.0 (/checkout/src/libsyntax_pos)
[00:05:51]    Compiling rustc_errors v0.0.0 (/checkout/src/librustc_errors)
[00:07:14]    Compiling proc_macro v0.0.0 (/checkout/src/libproc_macro)
[00:07:24]    Compiling syntax_ext v0.0.0 (/checkout/src/libsyntax_ext)
[00:07:24] error: expected one of `.`, `;`, `?`, or an operator, found `self`
[00:07:24]    --> librustc/util/profiling.rs:215:9
[00:07:24] 214 |             }
[00:07:24] 214 |             }
[00:07:24]     |              - expected one of `.`, `;`, `?`, or an operator here
[00:07:24] 215 |         self.current_timer.elapsed();
[00:07:24]     |         ^^^^ unexpected token
[00:07:29] error: unused import: `Duration`
[00:07:29]   --> librustc/util/profiling.rs:15:17
[00:07:29]    |
[00:07:29]    |
[00:07:29] 15 | use std::time::{Duration, Instant};
[00:07:29]    |
[00:07:29]    = note: `-D unused-imports` implied by `-D warnings`
[00:07:29] 
[00:07:56] error: aborting due to 2 previous errors
---
[00:07:56] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json"
[00:07:56] expected success, got: exit code: 101
[00:07:56] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap build
[00:07:56] Build completed unsuccessfully in 0:03:59
[00:07:56] Makefile:28: recipe for target 'all' failed
[00:07:56] make: *** [all] Error 1
72532 ./src/llvm/lib
69912 ./src/llvm-emscripten/lib
67936 ./src/test
56436 ./src/llvm/test/MC

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@wesleywiser wesleywiser force-pushed the wesleywiser:fix_self_profiler_windows branch from 290cbbc to 13c81da Nov 22, 2018

@estebank

Other than a couple of nitpicks, r=me.

Show resolved Hide resolved src/librustc/util/profiling.rs Outdated
Show resolved Hide resolved src/librustc/util/profiling.rs Outdated
if self.opts.debugging_opts.self_profile {
let mut profiler = self.self_profiling.borrow_mut();
f(&mut profiler);
}

This comment has been minimized.

@estebank

estebank Nov 23, 2018

Contributor

Was this change needed? (Not that it's wrong, just surprised it wasn't already the case).

This comment has been minimized.

@wesleywiser

wesleywiser Nov 25, 2018

Member

Not needed per se. It wasn't already the case because we showed a very small amount of overhead from turning on the profiler. I think it's probably best to make it opt-in though.

@michaelwoerister

This comment has been minimized.

Contributor

michaelwoerister commented Nov 23, 2018

❤️ ❤️ ❤️

[Windows] Work around non-monotonic clocks in the self-profiler
On Windows, the high-resolution timestamp api doesn't seem to always be
monotonic. This can cause panics when the self-profiler uses the
`Instant` api to find elapsed time.

Work around this by detecting the case where now is less than the start
time and just use 0 elapsed ticks as the measurement.

Fixes #51648

@wesleywiser wesleywiser force-pushed the wesleywiser:fix_self_profiler_windows branch from 13c81da to dce1c45 Nov 25, 2018

@wesleywiser

This comment has been minimized.

Member

wesleywiser commented Nov 25, 2018

@bors r=estebank

@bors

This comment has been minimized.

Contributor

bors commented Nov 25, 2018

📌 Commit dce1c45 has been approved by estebank

pietroalbini added a commit to pietroalbini/rust that referenced this pull request Nov 25, 2018

Rollup merge of rust-lang#56170 - wesleywiser:fix_self_profiler_windo…
…ws, r=estebank

Fix self profiler ICE on Windows

Fixes rust-lang#51648

bors added a commit that referenced this pull request Nov 25, 2018

Auto merge of #56215 - pietroalbini:rollup, r=pietroalbini
Rollup of 14 pull requests

Successful merges:

 - #56024 (Don't auto-inline const functions)
 - #56045 (Check arg/ret sizedness at ExprKind::Path)
 - #56072 (Stabilize macro_literal_matcher)
 - #56075 (Encode a custom "producers" section in wasm files)
 - #56100 (generator fields are not necessarily initialized)
 - #56101 (Incorporate `dyn` into more comments and docs.)
 - #56144 (Fix BTreeSet and BTreeMap gdb pretty-printers)
 - #56151 (Move a flaky process test out of libstd)
 - #56170 (Fix self profiler ICE on Windows)
 - #56176 (Panic setup msg)
 - #56204 (Suggest correct enum variant on typo)
 - #56207 (Stabilize the int_to_from_bytes feature)
 - #56210 (read_c_str should call the AllocationExtra hooks)
 - #56211 ([master] Forward-ports from beta)

Failed merges:

r? @ghost

@bors bors merged commit dce1c45 into rust-lang:master Nov 25, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment