Skip to content

Commit 9de9184

Browse files
committed
Trace some basic I/O operations in bootstrap
1 parent 1ae7c49 commit 9de9184

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

src/bootstrap/src/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1773,6 +1773,10 @@ impl Build {
17731773
if src == dst {
17741774
return;
17751775
}
1776+
1777+
#[cfg(feature = "tracing")]
1778+
let _span = tracing::trace_span!(target: "IO", "file-copy-link", ?src, ?dst).entered();
1779+
17761780
if let Err(e) = fs::remove_file(dst)
17771781
&& cfg!(windows)
17781782
&& e.kind() != io::ErrorKind::NotFound
@@ -1908,13 +1912,21 @@ impl Build {
19081912
if self.config.dry_run() {
19091913
return;
19101914
}
1915+
1916+
#[cfg(feature = "tracing")]
1917+
let _span = tracing::trace_span!(target: "IO", "dir-create", ?dir).entered();
1918+
19111919
t!(fs::create_dir_all(dir))
19121920
}
19131921

19141922
fn remove_dir(&self, dir: &Path) {
19151923
if self.config.dry_run() {
19161924
return;
19171925
}
1926+
1927+
#[cfg(feature = "tracing")]
1928+
let _span = tracing::trace_span!(target: "IO", "dir-remove", ?dir).entered();
1929+
19181930
t!(fs::remove_dir_all(dir))
19191931
}
19201932

src/doc/rustc-dev-guide/src/building/bootstrapping/debugging-bootstrap.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,11 @@ There are two orthogonal ways to control which kind of tracing logs you want:
8181
- If you select a level, all events/spans with an equal or higher priority level will be shown.
8282
2. You can also control the log **target**, e.g. `bootstrap` or `bootstrap::core::config` or a custom target like `CONFIG_HANDLING` or `STEP`.
8383
- Custom targets are used to limit what kinds of spans you are interested in, as the `BOOTSTRAP_TRACING=trace` output can be quite verbose. Currently, you can use the following custom targets:
84-
- `CONFIG_HANDLING`: show spans related to config handling
85-
- `STEP`: show all executed steps. Note that executed commands have `info` event level.
86-
- `COMMAND`: show all executed commands. Note that executed commands have `trace` event level.
84+
- `CONFIG_HANDLING`: show spans related to config handling.
85+
- `STEP`: show all executed steps. Executed commands have `info` event level.
86+
- `COMMAND`: show all executed commands. Executed commands have `trace` event level.
87+
- `IO`: show performed I/O operations. Executed commands have `trace` event level.
88+
- Note that many I/O are currently not being traced.
8789

8890
You can of course combine them (custom target logs are typically gated behind `TRACE` log level additionally):
8991

0 commit comments

Comments
 (0)