Add profile call

This commit is contained in:
Aleksey Kladov 2021-01-18 13:25:57 +03:00
parent fde4a860ae
commit e13065b8ac
4 changed files with 6 additions and 0 deletions

1
Cargo.lock generated
View file

@ -1231,6 +1231,7 @@ dependencies = [
"log",
"paths",
"proc_macro_api",
"profile",
"rustc-hash",
"serde",
"serde_json",

View file

@ -25,3 +25,4 @@ toolchain = { path = "../toolchain", version = "0.0.0" }
proc_macro_api = { path = "../proc_macro_api", version = "0.0.0" }
paths = { path = "../paths", version = "0.0.0" }
stdx = { path = "../stdx", version = "0.0.0" }
profile = { path = "../profile", version = "0.0.0" }

View file

@ -207,6 +207,7 @@ impl ProjectWorkspace {
proc_macro_client: Option<&ProcMacroClient>,
load: &mut dyn FnMut(&AbsPath) -> Option<FileId>,
) -> CrateGraph {
let _p = profile::span("ProjectWorkspace::to_crate_graph");
let proc_macro_loader = |path: &Path| match proc_macro_client {
Some(client) => client.by_dylib_path(path),
None => Vec::new(),
@ -299,6 +300,7 @@ fn cargo_to_crate_graph(
sysroot: &Sysroot,
rustc: &Option<CargoWorkspace>,
) -> CrateGraph {
let _p = profile::span("cargo_to_crate_graph");
let mut crate_graph = CrateGraph::default();
let (public_deps, libproc_macro) =
sysroot_to_crate_graph(&mut crate_graph, sysroot, target, load);
@ -493,6 +495,7 @@ fn sysroot_to_crate_graph(
target: Option<&str>,
load: &mut dyn FnMut(&AbsPath) -> Option<FileId>,
) -> (Vec<(CrateName, CrateId)>, Option<CrateId>) {
let _p = profile::span("sysroot_to_crate_graph");
let mut cfg_options = CfgOptions::default();
cfg_options.extend(get_rustc_cfg_options(target));
let sysroot_crates: FxHashMap<SysrootCrate, CrateId> = sysroot

View file

@ -274,6 +274,7 @@ impl GlobalState {
}
fn reload_flycheck(&mut self) {
let _p = profile::span("GlobalState::reload_flycheck");
let config = match self.config.flycheck() {
Some(it) => it,
None => {