Auto merge of #17102 - davidbarsky:david/add-some-tracing-to-project-loading, r=lnicola

chore: add some `tracing` to project loading

I wanted to see what's happening during project loading and if it could be parallelized. I'm thinking maybe, but it's not this PR :)
This commit is contained in:
bors 2024-04-22 15:56:06 +00:00
commit e31c9f3fe1
7 changed files with 33 additions and 5 deletions

View file

@ -17,6 +17,7 @@ use itertools::Itertools;
use proc_macro_api::{MacroDylib, ProcMacroServer};
use project_model::{CargoConfig, PackageRoot, ProjectManifest, ProjectWorkspace};
use span::Span;
use tracing::{instrument, Level};
use vfs::{file_set::FileSetConfig, loader::Handle, AbsPath, AbsPathBuf, VfsPath};
pub struct LoadCargoConfig {
@ -50,6 +51,7 @@ pub fn load_workspace_at(
load_workspace(workspace, &cargo_config.extra_env, load_config)
}
#[instrument(skip_all)]
pub fn load_workspace(
ws: ProjectWorkspace,
extra_env: &FxHashMap<String, String>,
@ -350,6 +352,7 @@ fn load_crate_graph(
}
}
vfs::loader::Message::Loaded { files } | vfs::loader::Message::Changed { files } => {
let _p = tracing::span!(Level::INFO, "LoadCargo::load_file_contents").entered();
for (path, contents) in files {
vfs.set_file_contents(path.into(), contents);
}