Commit Graph

191 Commits

Author SHA1 Message Date
bors b97fd3e5a1 Auto merge of #82754 - rylev:rusage-windows, r=pnkfelix
Attempt to gather similar stats as rusage on Windows

A follow up to #82532. This is a bit hacked in because I think we need to discuss this before merging, but this is an attempt to gather similar metrics as `libc::rusage` on Windows.

Some comments on differences:
* Currently, we're passing `RUSAGE_CHILDREN` to `rusage` which collects statistics on all children that have been waited on and terminated. I believe this is currently just the invocation of the real `rustc` that the shim is wrapping. Does `rustc` itself spawn children processes? The windows version gets the child processes handle when spawning it, and uses that to collect the statistics. For maxrss, `rusage` will return "the resident set size of the largest child, not the maximum resident set size of the process tree.", the Windows version will only collect statistics on the wrapped `rustc` child process directly even if some theoretical sub process has a larger memory footprint.
* There might be subtle differences between `rusage`'s "resident set" and Window's "working set". The "working set" and "resident set" should both be the number of pages that are in memory and which would not cause a page fault when accessed.
* I'm not yet sure how best to get the same information that `ru_minflt`, `ru_inblock`, `ru_oublock`, `ru_nivcsw ` and `ru_nvcsw` provide.

r? `@pnkfelix`
2021-03-19 12:44:33 +00:00
Ryan Levick 302867cf48 Clean up handling of child process 2021-03-11 16:23:25 +01:00
Felix S. Klock II 444a756769 Revise prefix a bit, adding both `--test` (conditionally) and `[RUSTC-SHIM]` unconditionally.
1. I added `--test` based on review feedback from simulacrum: I decided I would
rather include such extra context than get confused later on by its absence.
(However, I chose to encode it differently than how `[RUSTC-TIMING]` does... I
don't have much basis for doing so, other than `--test` to me more directly
reflects what it came from.)

2. I also decided to include `[RUSTC-SHIM]` at start of all of these lines
driven by the verbosity level, to make to clear where these lines of text
originate from. (Basically, I skimmed over the output and realized that a casual
observer might not be able to tell where this huge set of new lines were coming
from.)
2021-03-05 11:46:04 -05:00
Ryan Levick 0201e2bbde Add more windows specific numbers 2021-03-05 14:38:52 +01:00
Felix S. Klock II f5eb5c884f Make rustc shim's verbose output include crate_name being compiled.
This change is mainly motivated by an issue with the environment
printing I added in PR 82403: multiple rustc invocations progress
in parallel, and the environment output, spanning multiple lines,
gets interleaved in ways make it difficult to extra the enviroment settings.

(This aforementioned difficulty is more of a hiccup than an outright
show-stopper, because the environment variables tend to be the same for all of
the rustc invocations, so it doesn't matter too much if one mixes up which lines
one is looking at. But still: Better to fix it.)
2021-03-04 17:19:41 -05:00
Ryan Levick 8c718bd3f6 Attempt to gather similar stats as rusage on Windows 2021-03-04 11:24:54 +01:00
Yuki Okushi 1020ed3d50
Rollup merge of #82532 - pnkfelix:rustbuild-print-step-rusage, r=Mark-Simulacrum
Add `build.print_step_rusage` to config.toml

Adds `build.print_step_rusage` to config.toml, which is meant to be an easy way to let compiler developers get feedback on the terminal during bootstrap about resource usage during each step.

The output is piggy-backed on `[PRINT-STEP-TIMINGS]`, mostly because the functionality seemed to naturally fit there in the overall control-flow and output structure (even if very little is shared between the implementations themselves).

Some sample output (from my Linux box, where I believe the `max rss` output to be somewhat trust-worthy...):

```
[...]
   Compiling regex v1.4.3
[RUSTC-TIMING] tempfile test:false 0.323 user: 1.418662 sys: 0.81767 max rss (kb): 182084 page reclaims: 26615 page faults: 0 fs block inputs: 0 fs block outputs: 2160 voluntary ctxt switches: 798 involuntary ctxt switches: 131
   Completed tempfile v3.1.0 in 0.3s
[RUSTC-TIMING] chalk_ir test:false 1.890 user: 1.893603 sys: 0.99663 max rss (kb): 239432 page reclaims: 32107 page faults: 0 fs block inputs: 0 fs block outputs: 25008 voluntary ctxt switches: 108 involuntary ctxt switches: 183
   Completed chalk-ir v0.55.0 in 1.9s
   Compiling rustc_data_structures v0.0.0 (/home/pnkfelix/Dev/Rust/rust.git/compiler/rustc_data_structures)
[RUSTC-TIMING] chrono test:false 1.244 user: 3.333198 sys: 0.134963 max rss (kb): 246612 page reclaims: 44857 page faults: 0 fs block inputs: 0 fs block outputs: 11704 voluntary ctxt switches: 1043 involuntary ctxt switches: 326
   Completed chrono v0.4.15 in 1.3s
[RUSTC-TIMING] rustc_rayon test:false 1.332 user: 1.763912 sys: 0.75996 max rss (kb): 239076 page reclaims: 35285 page faults: 0 fs block inputs: 0 fs block outputs: 19576 voluntary ctxt switches: 359 involuntary ctxt switches: 168
   Completed rustc-rayon v0.3.0 in 1.3s
   Compiling matchers v0.0.1
[RUSTC-TIMING] matchers test:false 0.100 user: 0.94495 sys: 0.15119 max rss (kb): 140076 page reclaims: 8200 page faults: 0 fs block inputs: 0 fs block outputs: 392 voluntary ctxt switches: 43 involuntary ctxt switches: 12
   Completed matchers v0.0.1 in 0.1s
[...]
```
2021-03-01 15:07:35 +09:00
Felix S. Klock II f2d70c5d18 Implementation of build.print_step_rusage.
On non-unix platforms, does not try to call `getrusage` (and does not attempt to
implement its own shim; that could be follow-on work, though its probably best
to not invest too much effort there, versus using separate dedicated tooling).

On unix platforms, calls libc::rusage and attempts to emit the subset of fields
that are supported on Linux and Mac OS X. Omits groups of related stats which
appear to be unsupported on the platform (due to them all remaining zero).

Adjusts output to compensate for Mac using bytes instead of kb (a well known
discrepancy on Mac OS X). However, so far I observe a lot of strange values
(orders of magnitude wrong) reported on Mac OS X in some cases, so I would not
trust this in that context currently.
2021-02-25 11:38:52 -05:00
Felix S. Klock II 9fafffd50b Print out env vars related to Rust on (sufficiently verbose) rustc invocations.
Fix issue 38686.

(update: placated tidy.)
2021-02-22 11:43:13 -05:00
Henry Boisdequin e13f25cd66 make suggest setup help messages better 2021-02-17 12:26:02 +05:30
Winnie Xiao d7494af551 Mostly print statements to see where things are
More print statementsstatements lol

Solved the basic case of eliminating check_version ifk_version if subcommand = setup

Finished v1

checking out old bootstrap.py

checked out old irrelevant files

fixed tidy

Moved VERSION from bin/main.rs to lib.rs

Fixed semicolon return issue

x.py fmt
2020-10-11 22:32:06 +02:00
bors 6f56fbdc1c Auto merge of #77347 - jyn514:dox, r=Amanieu
Remove --cfg dox from rustdoc.rs

This was added in https://github.com/rust-lang/rust/pull/53076 because
several dependencies were using `cfg(dox)` instead of `cfg(rustdoc)` (now `cfg(doc)`).
I ran `rg 'cfg\(dox\)'` on the source tree with no matches, so I think
this is now safe to remove.

r? `@Mark-Simulacrum`
cc `@QuietMisdreavus` :)
2020-10-03 07:23:02 +00:00
Joshua Nelson 351f850d33 Remove unused --cfg stageN 2020-09-29 18:25:52 -04:00
Joshua Nelson 6533c29bea Remove --cfg dox from rustdoc.rs
This was added in https://github.com/rust-lang/rust/pull/53076 because
several dependencies were using `cfg(dox)` instead of `cfg(rustdoc)`.
I ran `rg 'cfg\(dox\)'` on the source tree with no matches, so I think
this is now safe to remove.
2020-09-29 18:00:19 -04:00
Tyler Mandry 6bd57e3531 Bump bootstrap version and update changelog 2020-09-28 20:15:43 +00:00
Ralf Jung c39598aeea
Rollup merge of #76631 - jyn514:x.py-setup, r=Mark-Simulacrum
Add `x.py setup`

Closes #76503.

- Suggest `x.py setup` if config.toml doesn't exist yet
- Prompt for a profile if not given on the command line
- Print the configuration that will be used
- Print helpful starting commands after setup
- Link to the dev-guide after finishing
2020-09-26 12:58:13 +02:00
Joshua Nelson 9baa601afd Add `x.py setup`
- Suggest `x.py setup` if config.toml doesn't exist yet (twice, once
before and once after the build)
- Prompt for a profile if not given on the command line
- Print the configuration file that will be used
- Print helpful starting commands after setup
- Link to the dev-guide after finishing
- Note that distro maintainers will see the changelog warning
2020-09-24 10:32:45 -04:00
Matthias Krüger b5d47bfa3a clarify that `changelog-seen = 1` goes to the beginning of config.toml
Fixes #77105
2020-09-23 15:45:35 +02:00
Joshua Nelson fe6fc555ac Add a changelog for x.py
- Add a changelog and instructions for updating it
- Use `changelog-seen` in `config.toml` and `VERSION` in bootstrap to determine whether the changelog has been read
- Nag people if they haven't read the x.py changelog
  + Print message twice to make sure it's seen
- Give different error messages depending on whether the version needs to be updated or added
2020-09-21 09:08:18 -04:00
Vadim Petrochenkov 5118a51b4d rustbuild: Propagate LLD to more places when `use-lld` is enabled 2020-09-07 00:40:07 +03:00
Eric Huss 73b7a04032 Fix crate-version with rustdoc in bootstrap. 2020-08-14 14:50:18 -07:00
Mark Rousskov cc7abc7563 Avoid dumping rustc invocations to stdout
These are quite long, usually, and in most cases not interesting. On smaller
terminals they can take up more than a full page of output, hiding the error
diagnostics emitted.
2020-08-02 10:54:13 -04:00
Ximin Luo e7089a97e7 rustbuild: refactor how the wrapper deals with exit codes 2020-07-27 23:22:07 +01:00
Ximin Luo 3dcab2922c rustbuild: format both Ok/Err separately, since Result doesn't do it 2020-07-27 22:44:48 +01:00
Ximin Luo 84896c7f09 rustbuild: use Display for exit status instead of Debug, see #74832 for justification 2020-07-27 22:06:04 +01:00
Ximin Luo b99668bd22 rustbuild: rename exec_cmd -> status_code for clarity 2020-07-27 03:00:28 +01:00
Ximin Luo 0cf17e750d rustbuild: fix bad usage of UNIX exec() in rustc wrapper
exec never returns, it replaces the current process. so anything after it is
unreachable. that's not how exec_cmd() is used in the surrounding code
2020-07-27 02:43:47 +01:00
Manish Goregaokar e5532436a1
Rollup merge of #74046 - ehuss:deny-warnings-caching, r=Mark-Simulacrum
Fix caching issue when building tools.

This fixes a problem with tool builds not being cached properly.

#73297 changed it so that Clippy will participate in the "deny warnings" setting. Unfortunately this causes a problem because Clippy shares the build directory with other tools which do not participate in "deny warnings".  Because Cargo does not independently cache artifacts based on different RUSTFLAGS settings, it causes all the shared dependencies to get rebuilt if Clippy ever gets built.

The solution here is to stop using RUSTFLAGS, and just sneak the settings in through the rustc wrapper. Cargo won't know about the different settings, so it will not bust the cache. This should be safe since lint settings on dependencies are ignored. This is how things used to work in the past before #64316.

Alternate solutions:
* Treat Clippy as a "submodule" and don't enforce warnings on it. This was the behavior before #73297. The consequence is that if a warning sneaks into clippy, that the clippy maintainers will need to fix it when they sync clippy back to the clippy repo.
* Just deny warnings on all tools (removing the in-tree/submodule distinction). This is tempting, but with some issues (cc #52336):
  * Adding or changing warnings in rustc can be difficult to land because tools have to be updated if they trip the warning. In practice, this isn't too bad.  Cargo (and rustfmt) already runs with `deny(warnings)`, so this has been the de-facto standard already (although they do not use the extra lints like `unused_lifetimes`).
* Teach Cargo to add flags to the workspace members, but not dependencies.
* Teach Cargo to add flags without fingerprinting them?
* Teach Cargo to independently cache different RUSTFLAGS artifacts (this was [reverted](https://github.com/rust-lang/cargo/pull/7417) due to complications). This would also unnecessarily rebuild dependencies, but would avoid cache thrashing.
* Teach Cargo about lint settings.

Closes #74016
2020-07-13 22:23:08 -07:00
Manish Goregaokar 218d96ed6b
Rollup merge of #70563 - GuillaumeGomez:page-hash-handling, r=ollie27,kinnison
[rustdoc] Page hash handling

Fixes https://github.com/rust-lang/rust/issues/70476

A good example to see the change is to use this URL: https://doc.rust-lang.org/nightly/std/string/struct.String.html#from_iter.v-3

After the change, it actually goes to the target element (and change the page hash to something more clear for the users).

r? @kinnison

cc @ollie27
2020-07-06 17:45:15 -07:00
Eric Huss 310c97b6ba Fix caching issue when building tools. 2020-07-04 14:46:04 -07:00
Guillaume Gomez e955bebcda Remove render-redirect-pages option in rustdoc 2020-07-02 14:14:59 +02:00
Alex Crichton 3dfbf0bc73 rustbuild: Move compiler-builtins build logic to manifest
This commit moves the compiler-builtins-specific build logic from
`src/bootstrap/bin/rustc.rs` into the workspace `Cargo.toml`'s
`[profile]` configuration. Now that rust-lang/cargo#7253 is fixed we can
ensure that Cargo knows about debug assertions settings, and it can also
be configured to specifically disable debug assertions unconditionally
for compiler-builtins. This should improve rebuild logic when
debug-assertions settings change and also improve build-std integration
where Cargo externally now has an avenue to learn how to build
compiler-builtins as well.
2020-06-29 06:53:56 -07:00
Alex Crichton 0546d11528 Fix cross-compiling LLD to different platforms
Looks like the native build system isn't great a coping with this, so
try to work around that with a few workarounds.
2020-04-24 11:18:59 -07:00
Vadim Petrochenkov 8771319dfa rustbuild: Remove LLD flavor workaround for MSVC 2020-04-12 21:04:17 +03:00
Guillaume Gomez c57de34e8f Stabilize --crate-version option in rustdoc 2020-02-26 22:08:59 +01:00
bors 1ad6b5e1e6 Auto merge of #68623 - Zoxc:lld, r=Mark-Simulacrum
Add an option to use LLD to link the compiler on Windows platforms

Based on https://github.com/rust-lang/rust/pull/68609.

Using LLD is good way to improve compile times on Windows since `link.exe` is quite slow. The time for `x.py build --stage 1 src/libtest` goes from 0:12:00 to 0:08:29. Compile time for `rustc_driver` goes from 226.34s to 18.5s. `rustc_macros` goes from 28.69s to 7.7s. The size of `rustc_driver` is also reduced from 83.3 MB to 78.7 MB.

r? @Mark-Simulacrum
2020-02-09 15:24:50 +00:00
Matthias Krüger 5f979e9afa bootstrap: fix clippy warnings 2020-02-03 20:26:36 +01:00
John Kåre Alsaker bfba6ef328 Add an option to use LLD to link the compiler on Windows platforms 2020-01-29 18:05:36 +01:00
Mark Rousskov a06baa56b9 Format the world 2019-12-22 17:42:47 -05:00
Guillaume Gomez 0282c27781 rename cfg(rustdoc) into cfg(doc) 2019-11-06 18:32:51 +01:00
Alex Crichton 160787129b Add some FIXME for future Cargo issues 2019-09-23 09:34:44 -07:00
Alex Crichton 385470b8bb Move handling of `-Cprefer-dynamic` into `builder.rs`
This logic is *super* old and can be tweaked and moved into `builder.rs`
2019-09-23 09:34:44 -07:00
Alex Crichton b3f95f460f Move `--cfg bootstrap` out of `rustc.rs`
Instead let's do this via `RUSTFLAGS` in `builder.rs`. Currently
requires a submodule update of `stdarch` to fix a problem with previous
compilers.
2019-09-23 09:34:44 -07:00
Alex Crichton a816fa185b Move handling of `RUSTC_PARALLEL_COMPILER` to `compile.rs`
No longer needs to live in `rustc.rs`
2019-09-23 09:34:44 -07:00
Alex Crichton 3d13f46304 Move handling of `{MUSL,WASI}_ROOT` to `compile.rs`
No longer any need for them to live in `rustc.rs`!
2019-09-23 09:34:44 -07:00
Alex Crichton 5cc6eb4082 Move debuginfo level handling to `builder.rs` 2019-09-23 09:34:44 -07:00
Alex Crichton 5abc4cd01c Remove duplication of `RUSTC_DEBUGINFO_MAP` in rustc.rs 2019-09-23 09:34:44 -07:00
Alex Crichton 2d6f3fede0 Move handling of `codegen-units` to `builder.rs` 2019-09-23 09:34:44 -07:00
Alex Crichton 22699d3139 Move handling of internal lints to `build.rs` 2019-09-23 09:34:44 -07:00
Alex Crichton f8b19f2b78 Move handling of some warnings to `builder.rs` 2019-09-23 09:34:44 -07:00