Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
02ac116
Fix tests for big-endian
fneddy Jul 29, 2025
2db126d
Include whitespace in "remove `|`" suggestion and make it hidden
estebank Mar 1, 2025
38df158
cfg_select: Support unbraced expressions
joshtriplett Aug 10, 2025
e6dddcb
Store bootstrap tracing outputs to a unified directory
Kobzol Aug 10, 2025
c97b606
Store `latest` symlink to the latest tracing output directory
Kobzol Aug 10, 2025
f819729
Store Chrome step trace into the tracing directory
Kobzol Aug 10, 2025
aad5795
Use shorter command span label
Kobzol Aug 10, 2025
3a115ba
Print step timings also when the stap starts to execute
Kobzol Aug 10, 2025
c846f7c
Replace `tracing_forest` with custom span formatting
Kobzol Aug 11, 2025
1e14229
Create a span for each executed step
Kobzol Aug 11, 2025
690c781
Remove ad-hoc print of executed/cached steps in verbose mode
Kobzol Aug 11, 2025
d403934
Remove manual `#[instrument]` annotations on steps
Kobzol Aug 11, 2025
604c180
Move tracing setup to the `tracing` module
Kobzol Aug 11, 2025
c3682b2
Correctly show executed command name in Chrome trace
Kobzol Aug 11, 2025
b4a357f
Always profile commands and generate Chrome profile when tracing is e…
Kobzol Aug 11, 2025
f9a4588
Do not create a span for cached commands
Kobzol Aug 11, 2025
12828f7
Create tracing directory symlink even during dry run
Kobzol Aug 11, 2025
3e77562
Use `pretty_step_name` in `step_graph`
Kobzol Aug 11, 2025
a0306bf
Update debugging/profiling bootstrap page
Kobzol Aug 11, 2025
6f584bc
Print created location of executed commands
Kobzol Aug 11, 2025
0b8c6ad
Remove one dependency from tracing bootstrap build
Kobzol Aug 12, 2025
ebcbcc8
bootstrap: Fix jemalloc 64K page support for aarch64 tools
CathalMullan Aug 13, 2025
d10a8a3
bootstrap: Support passing `--timings` to cargo
joshtriplett Aug 14, 2025
3ecea53
bootstrap: Update completions for new --timings argument
joshtriplett Aug 14, 2025
f382d54
Remove `ONLY_HOSTS` value overrides that just set the default value a…
Kobzol Aug 12, 2025
e08c755
Rename and document `ONLY_HOSTS` in bootstrap
Kobzol Aug 12, 2025
1a226e0
rustc-dev-guide :3
lcnr Aug 14, 2025
eba1596
Use `default_field_values` in `Resolver`
estebank Jul 12, 2025
b67cd4c
cleanup: Remove useless `[T].iter().last()`
estebank Aug 14, 2025
65d329d
Adjust error message grammar to be less awkward
shepmaster Aug 14, 2025
18afb69
Rollup merge of #137872 - estebank:extra-vert, r=compiler-errors
Kobzol Aug 14, 2025
fadd083
Rollup merge of #144631 - fneddy:fix_be_test_intrinsic_const_bad, r=c…
Kobzol Aug 14, 2025
01bd889
Rollup merge of #145233 - joshtriplett:cfg-select-expr, r=jieyouxu
Kobzol Aug 14, 2025
ebd4a10
Rollup merge of #145261 - Kobzol:bootstrap-tracing, r=jieyouxu
Kobzol Aug 14, 2025
06246bf
Rollup merge of #145324 - Kobzol:bootstrap-host-only, r=jieyouxu
Kobzol Aug 14, 2025
55f2234
Rollup merge of #145353 - CathalMullan:jemalloc-tools, r=Kobzol
Kobzol Aug 14, 2025
86c25f8
Rollup merge of #145379 - joshtriplett:bootstrap-timings, r=jieyouxu
Kobzol Aug 14, 2025
1eda78f
Rollup merge of #145397 - lcnr:lcnr/rustc-dev-guide-3, r=BoxyUwU
Kobzol Aug 14, 2025
93e895b
Rollup merge of #145398 - estebank:use-default-fields-resolver, r=pet…
Kobzol Aug 14, 2025
603ee15
Rollup merge of #145401 - estebank:remove-useless-iter, r=compiler-er…
Kobzol Aug 14, 2025
0698921
Rollup merge of #145403 - shepmaster:grammar, r=estebank
Kobzol Aug 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Store Chrome step trace into the tracing directory
  • Loading branch information
Kobzol committed Aug 11, 2025
commit f819729539481f6ca302466caf527fa798815850
3 changes: 2 additions & 1 deletion src/bootstrap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ default-run = "bootstrap"

[features]
build-metrics = ["sysinfo"]
tracing = ["dep:tracing", "dep:tracing-chrome", "dep:tracing-subscriber", "dep:tracing-forest"]
tracing = ["dep:tracing", "dep:tracing-chrome", "dep:tracing-subscriber", "dep:tracing-forest", "dep:tempfile"]

[lib]
path = "src/lib.rs"
Expand Down Expand Up @@ -65,6 +65,7 @@ tracing = { version = "0.1", optional = true, features = ["attributes"] }
tracing-chrome = { version = "0.7", optional = true }
tracing-subscriber = { version = "0.3", optional = true, features = ["env-filter", "fmt", "registry", "std"] }
tracing-forest = { version = "0.1.6", optional = true, default-features = false, features = ["smallvec", "ansi", "env-filter"] }
tempfile = { version = "3.15.0", optional = true }

[target.'cfg(windows)'.dependencies.junction]
version = "1.0.0"
Expand Down
59 changes: 46 additions & 13 deletions src/bootstrap/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fn is_tracing_enabled() -> bool {
#[cfg_attr(feature = "tracing", instrument(level = "trace", name = "main"))]
fn main() {
#[cfg(feature = "tracing")]
let _guard = setup_tracing();
let guard = setup_tracing(is_profiling_enabled());

let start_time = Instant::now();

Expand Down Expand Up @@ -183,7 +183,12 @@ fn main() {
}

#[cfg(feature = "tracing")]
build.report_step_graph(&tracing_dir);
{
build.report_step_graph(&tracing_dir);
if let Some(guard) = guard {
guard.copy_to_dir(&tracing_dir);
}
}

if tracing_enabled {
eprintln!("Tracing/profiling output has been written to {}", latest_trace_dir.display());
Expand Down Expand Up @@ -257,25 +262,53 @@ fn check_version(config: &Config) -> Option<String> {
// - `tracing`'s `#[instrument(..)]` macro will need to be gated like `#![cfg_attr(feature =
// "tracing", instrument(..))]`.
#[cfg(feature = "tracing")]
fn setup_tracing() -> impl Drop {
fn setup_tracing(profiling_enabled: bool) -> Option<TracingGuard> {
use std::fs::File;
use std::io::BufWriter;

use tracing_forest::ForestLayer;
use tracing_subscriber::EnvFilter;
use tracing_subscriber::layer::SubscriberExt;

let filter = EnvFilter::from_env("BOOTSTRAP_TRACING");

let mut chrome_layer = tracing_chrome::ChromeLayerBuilder::new().include_args(true);
let registry = tracing_subscriber::registry().with(filter).with(ForestLayer::default());

// Writes the Chrome profile to trace-<unix-timestamp>.json if enabled
if !is_profiling_enabled() {
chrome_layer = chrome_layer.writer(io::sink());
}
let guard = if profiling_enabled {
// When we're creating this layer, we do not yet know the location of the tracing output
// directory, because it is stored in the output directory determined after Config is parsed,
// but we already want to make tracing calls during (and before) config parsing.
// So we store the output into a temporary file, and then move it to the tracing directory
// before bootstrap ends.
let tempdir = tempfile::TempDir::new().expect("Cannot create temporary directory");
let chrome_tracing_path = tempdir.path().join("bootstrap-trace.json");
let file = BufWriter::new(File::create(&chrome_tracing_path).unwrap());

let (chrome_layer, _guard) = chrome_layer.build();
let chrome_layer =
tracing_chrome::ChromeLayerBuilder::new().writer(file).include_args(true);
let (chrome_layer, guard) = chrome_layer.build();

let registry =
tracing_subscriber::registry().with(filter).with(ForestLayer::default()).with(chrome_layer);
tracing::subscriber::set_global_default(registry.with(chrome_layer)).unwrap();
Some(TracingGuard { guard, _tempdir: tempdir, chrome_tracing_path })
} else {
tracing::subscriber::set_global_default(registry).unwrap();
None
};

tracing::subscriber::set_global_default(registry).unwrap();
_guard
guard
}

#[cfg(feature = "tracing")]
struct TracingGuard {
guard: tracing_chrome::FlushGuard,
_tempdir: tempfile::TempDir,
chrome_tracing_path: std::path::PathBuf,
}

#[cfg(feature = "tracing")]
impl TracingGuard {
fn copy_to_dir(self, dir: &std::path::Path) {
drop(self.guard);
std::fs::rename(&self.chrome_tracing_path, dir.join("chrome-trace.json")).unwrap();
}
}