Skip to content

Commit 95b921b

Browse files
committed
Auto merge of #13951 - epage:trace, r=ehuss
Add more high level traces This accounts for more time when running rustc (which turns out to be a significant amount of time). I'm less sure about the start/wait calls but I'm seeing very different results from different builds of `cargo` and some have some large amounts of unaccounted time that I want to dig into (and callgrind and and samply haven't helped).
2 parents 145b225 + 8cfcceb commit 95b921b

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Diff for: src/cargo/core/compiler/build_context/target_info.rs

+2
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ impl TargetInfo {
152152
/// invocation is cached by [`Rustc::cached_output`].
153153
///
154154
/// Search `Tricky` to learn why querying `rustc` several times is needed.
155+
#[tracing::instrument(skip_all)]
155156
pub fn new(
156157
gctx: &GlobalContext,
157158
requested_kinds: &[CompileKind],
@@ -878,6 +879,7 @@ pub struct RustcTargetData<'gctx> {
878879
}
879880

880881
impl<'gctx> RustcTargetData<'gctx> {
882+
#[tracing::instrument(skip_all)]
881883
pub fn new(
882884
ws: &Workspace<'gctx>,
883885
requested_kinds: &[CompileKind],

Diff for: src/cargo/core/package.rs

+2
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,7 @@ impl<'a, 'gctx> Downloads<'a, 'gctx> {
654654
/// Returns `None` if the package is queued up for download and will
655655
/// eventually be returned from `wait_for_download`. Returns `Some(pkg)` if
656656
/// the package is ready and doesn't need to be downloaded.
657+
#[tracing::instrument(skip_all)]
657658
pub fn start(&mut self, id: PackageId) -> CargoResult<Option<&'a Package>> {
658659
self.start_inner(id)
659660
.with_context(|| format!("failed to download `{}`", id))
@@ -793,6 +794,7 @@ impl<'a, 'gctx> Downloads<'a, 'gctx> {
793794
/// # Panics
794795
///
795796
/// This function will panic if there are no remaining downloads.
797+
#[tracing::instrument(skip_all)]
796798
pub fn wait(&mut self) -> CargoResult<&'a Package> {
797799
let (dl, data) = loop {
798800
assert_eq!(self.pending.len(), self.pending_ids.len());

0 commit comments

Comments
 (0)