diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-10-06 14:51:45 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-10-06 15:49:44 +1100 |
| commit | 9110d925d0b3e4842376e830f4404a28e1aa2658 (patch) | |
| tree | a88bf360a52f99308e449aed4e6451ef54cb7e68 /compiler/rustc_session | |
| parent | eea06de0c894921deab541ad03c5ab728d4c449b (diff) | |
| download | rust-9110d925d0b3e4842376e830f4404a28e1aa2658.tar.gz rust-9110d925d0b3e4842376e830f4404a28e1aa2658.zip | |
Remove `-Ztime` option.
The compiler currently has `-Ztime` and `-Ztime-passes`. I've used `-Ztime-passes` for years but only recently learned about `-Ztime`. What's the difference? Let's look at the `-Zhelp` output: ``` -Z time=val -- measure time of rustc processes (default: no) -Z time-passes=val -- measure time of each rustc pass (default: no) ``` The `-Ztime-passes` description is clear, but the `-Ztime` one is less so. Sounds like it measures the time for the entire process? No. The real difference is that `-Ztime-passes` prints out info about passes, and `-Ztime` does the same, but only for a subset of those passes. More specifically, there is a distinction in the profiling code between a "verbose generic activity" and an "extra verbose generic activity". `-Ztime-passes` prints both kinds, while `-Ztime` only prints the first one. (It took me a close reading of the source code to determine this difference.) In practice this distinction has low value. Perhaps in the past the "extra verbose" output was more voluminous, but now that we only print stats for a pass if it exceeds 5ms or alters the RSS, `-Ztime-passes` is less spammy. Also, a lot of the "extra verbose" cases are for individual lint passes, and you need to also use `-Zno-interleave-lints` to see those anyway. Therefore, this commit removes `-Ztime` and the associated machinery. One thing to note is that the existing "extra verbose" activities all have an extra string argument, so the commit adds the ability to accept an extra argument to the "verbose" activities.
Diffstat (limited to 'compiler/rustc_session')
| -rw-r--r-- | compiler/rustc_session/src/options.rs | 11 | ||||
| -rw-r--r-- | compiler/rustc_session/src/session.rs | 11 |
2 files changed, 5 insertions, 17 deletions
diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 486c514a4f5..8d527c05122 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -280,14 +280,6 @@ macro_rules! options { ) } -impl Options { - // JUSTIFICATION: defn of the suggested wrapper fn - #[allow(rustc::bad_opt_access)] - pub fn time_passes(&self) -> bool { - self.unstable_opts.time_passes || self.unstable_opts.time - } -} - impl CodegenOptions { // JUSTIFICATION: defn of the suggested wrapper fn #[allow(rustc::bad_opt_access)] @@ -1596,9 +1588,6 @@ options! { #[rustc_lint_opt_deny_field_access("use `Session::threads` instead of this field")] threads: usize = (1, parse_threads, [UNTRACKED], "use a thread pool with N threads"), - #[rustc_lint_opt_deny_field_access("use `Session::time_passes` instead of this field")] - time: bool = (false, parse_bool, [UNTRACKED], - "measure time of rustc processes (default: no)"), #[rustc_lint_opt_deny_field_access("use `Session::time_llvm_passes` instead of this field")] time_llvm_passes: bool = (false, parse_bool, [UNTRACKED], "measure time of each LLVM pass (default: no)"), diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 59b544ce9eb..5926cdc9dad 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -606,10 +606,6 @@ impl Session { self.parse_sess.source_map() } - pub fn time_passes(&self) -> bool { - self.opts.time_passes() - } - /// Returns `true` if internal lints should be added to the lint store - i.e. if /// `-Zunstable-options` is provided and this isn't rustdoc (internal lints can trigger errors /// to be emitted under rustdoc). @@ -927,6 +923,10 @@ impl Session { self.opts.unstable_opts.instrument_mcount } + pub fn time_passes(&self) -> bool { + self.opts.unstable_opts.time_passes + } + pub fn time_llvm_passes(&self) -> bool { self.opts.unstable_opts.time_llvm_passes } @@ -1403,8 +1403,7 @@ pub fn build_session( CguReuseTracker::new_disabled() }; - let prof = - SelfProfilerRef::new(self_profiler, sopts.time_passes(), sopts.unstable_opts.time_passes); + let prof = SelfProfilerRef::new(self_profiler, sopts.unstable_opts.time_passes); let ctfe_backtrace = Lock::new(match env::var("RUSTC_CTFE_BACKTRACE") { Ok(ref val) if val == "immediate" => CtfeBacktrace::Immediate, |
