Skip to content

Commit 1851489

Browse files
authored
Merge pull request #1456 from nnethercote/rm-time-passes
Remove the `time-passes` profiling mode.
2 parents 9087689 + a52b495 commit 1851489

File tree

5 files changed

+15
-56
lines changed

5 files changed

+15
-56
lines changed

ci/check-profiling.sh

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,6 @@ cargo build -p collector --bin rustc-fake
2222

2323
# TODO: self-profile.
2424

25-
# time-passes.
26-
RUST_BACKTRACE=1 RUST_LOG=raw_cargo_messages=trace,collector=debug,rust_sysroot=debug \
27-
cargo run -p collector --bin collector -- \
28-
profile_local time-passes $bindir/rustc \
29-
--id Test \
30-
--profiles Check \
31-
--cargo $bindir/cargo \
32-
--include helloworld \
33-
--scenarios Full
34-
test -f results/Ztp-Test-helloworld-Check-Full
35-
grep -q "time:.*total" results/Ztp-Test-helloworld-Check-Full
36-
3725
# perf-record: untested because we get "The instructions:u event is not
3826
# supported" on GitHub Actions when the code below is run. Maybe because the
3927
# hardware is virtualized and performance counters aren't available?

collector/README.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -267,14 +267,6 @@ The mandatory `<PROFILER>` argument must be one of the following.
267267
`flamegraph`, viewable with a web browser, is written to a file with a
268268
`flamegraph` prefix. Output from `crox`, viewable with Chromium's profiler,
269269
is written to a file with a `crox` prefix.
270-
- `time-passes`: Profile with rustc's `-Ztime-passes`.
271-
- **Purpose**. This gives a high-level indication of compiler performance by
272-
showing how long each compilation pass takes.
273-
- **Slowdown**. None.
274-
- **Output**. Human-readable text output is written to files with a `Ztp`
275-
prefix. Note that the parents of indented sub-passes are shown below those
276-
passes, rather than above. Note also that the LLVM passes run in parallel,
277-
which can make the output confusing.
278270
- `perf-record`: Profile with
279271
[`perf-record`](https://perf.wiki.kernel.org/index.php/Main_Page), a
280272
sampling profiler.
@@ -374,16 +366,18 @@ The mandatory `<PROFILER>` argument must be one of the following.
374366
- **Slowdown**. Roughly 2--4x.
375367
- **Output**. Raw output is written to files with a `bytehound` prefix. Those
376368
files can be viewed with the `bytehound server <filename>` command.
377-
- `eprintln`: Profile with `eprintln!` statements.
369+
- `eprintln`: Profile via stderr, e.g. by using `eprintln!` statements.
378370
- **Purpose**. Sometimes it is useful to do ad hoc profiling by inserting
379371
`eprintln!` statements into rustc, e.g. to count how often particular paths
380372
are hit, or to see what values particular expressions have each time they
381-
are executed.
382-
- **Slowdown**. Depends where the `eprintln!` statements are inserted.
383-
- **Output**. The output of these `eprintln!` statements (and everything else
384-
written to `stderr`) is written to files with an `eprintln` prefix. Those
385-
files can be post-processed in any appropriate fashion;
386-
[`counts`](https://github.com/nnethercote/counts) is one possibility.
373+
are executed. Alternatively, you can trigger some of rustc's built-in
374+
profiling modes via environment variables, such as
375+
`RUSTFLAGS=-Ztime-passes` or `RUSTFLAGS=-Zhir-stats`.
376+
- **Slowdown**. Depends on how much extra output is being produced on stderr.
377+
- **Output**. Everything written to stderr is copied to files with an
378+
`eprintln` prefix. Those files can be post-processed in any appropriate
379+
fashion; [`counts`](https://github.com/nnethercote/counts) is one
380+
possibility.
387381
- `llvm-lines`: Profile with [`cargo
388382
llvm-lines`](https://github.com/dtolnay/cargo-llvm-lines/) a code size
389383
measurer.

collector/src/bin/rustc-fake.rs

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -205,17 +205,6 @@ fn main() {
205205
run_with_determinism_env(cmd);
206206
}
207207

208-
"TimePasses" => {
209-
let mut cmd = Command::new(&tool);
210-
cmd.arg("-Ztime-passes")
211-
.args(args)
212-
.stderr(std::process::Stdio::from(
213-
std::fs::File::create("Ztp").unwrap(),
214-
));
215-
216-
run_with_determinism_env(cmd);
217-
}
218-
219208
"PerfRecord" => {
220209
let mut cmd = Command::new("perf");
221210
let has_perf = cmd.output().is_ok();
@@ -345,12 +334,12 @@ fn main() {
345334

346335
"LlvmLines" => {
347336
// `cargo llvm-lines` writes its output to stdout. But we can't
348-
// redirect it to a file here like we do for "time-passes" and
349-
// "eprintln". This is because `cargo llvm-lines` invokes rustc
350-
// as part of its processing and then it does some analysis of
351-
// its output and then it prints out some results. Because
352-
// `rustc` (which this file wraps) doesn't produce the output,
353-
// this file can't redirect that output.
337+
// redirect it to a file here like we do for "eprintln". This
338+
// is because `cargo llvm-lines` invokes rustc as part of its
339+
// processing and then it does some analysis of its output and
340+
// then it prints out some results. Because `rustc` (which this
341+
// file wraps) doesn't produce the output, this file can't
342+
// redirect that output.
354343
let mut cmd = Command::new(&tool);
355344
cmd.args(&args);
356345

collector/src/execute/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ impl PerfTool {
4949
| BenchTool(XperfStat)
5050
| BenchTool(XperfStatSelfProfile)
5151
| ProfileTool(SelfProfile)
52-
| ProfileTool(TimePasses)
5352
| ProfileTool(PerfRecord)
5453
| ProfileTool(Oprofile)
5554
| ProfileTool(Cachegrind)
@@ -85,7 +84,6 @@ impl PerfTool {
8584
| BenchTool(XperfStat)
8685
| BenchTool(XperfStatSelfProfile)
8786
| ProfileTool(SelfProfile)
88-
| ProfileTool(TimePasses)
8987
| ProfileTool(PerfRecord)
9088
| ProfileTool(Oprofile)
9189
| ProfileTool(Cachegrind)

collector/src/execute/profiler.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use std::{fs, process};
1212
#[derive(Clone, Copy, Debug, PartialEq, clap::ArgEnum)]
1313
pub enum Profiler {
1414
SelfProfile,
15-
TimePasses,
1615
PerfRecord,
1716
Oprofile,
1817
Cachegrind,
@@ -157,15 +156,6 @@ impl<'a> Processor for ProfileProcessor<'a> {
157156
utils::fs::rename("chrome_profiler.json", crox_file)?;
158157
}
159158

160-
// `-Ztime-passes` output is redirected (via rustc-fake) to a file
161-
// called `Ztp`. We copy that output into a file in the output dir.
162-
Profiler::TimePasses => {
163-
let tmp_ztp_file = filepath(data.cwd.as_ref(), "Ztp");
164-
let ztp_file = filepath(self.output_dir, &out_file("Ztp"));
165-
166-
fs::copy(&tmp_ztp_file, &ztp_file)?;
167-
}
168-
169159
// perf-record produces (via rustc-fake) a data file called `perf`.
170160
// We copy it from the temp dir to the output dir, giving it a new
171161
// name in the process.

0 commit comments

Comments
 (0)