From 6b187af33712498196233883f8a20588eb314685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Thu, 22 Apr 2021 21:25:29 +0300 Subject: [PATCH] Add profiling spans under cargo_to_crate_graph --- Cargo.lock | 1 + crates/proc_macro_api/Cargo.toml | 7 ++++--- crates/proc_macro_api/src/lib.rs | 1 + crates/rust-analyzer/src/reload.rs | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 14decc14ea..72dcb9ba70 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1174,6 +1174,7 @@ dependencies = [ "log", "memmap", "object", + "profile", "serde", "serde_json", "snap", diff --git a/crates/proc_macro_api/Cargo.toml b/crates/proc_macro_api/Cargo.toml index 16fd56c7ec..1ba1e4abd5 100644 --- a/crates/proc_macro_api/Cargo.toml +++ b/crates/proc_macro_api/Cargo.toml @@ -15,10 +15,11 @@ serde_json = { version = "1.0", features = ["unbounded_depth"] } log = "0.4.8" crossbeam-channel = "0.5.0" jod-thread = "0.1.1" +memmap = "0.7.0" +object = { version = "0.23.0", default-features = false, features = ["std", "read_core", "elf", "macho", "pe", "unaligned"] } +snap = "1.0" tt = { path = "../tt", version = "0.0.0" } base_db = { path = "../base_db", version = "0.0.0" } stdx = { path = "../stdx", version = "0.0.0" } -snap = "1" -object = { version = "0.23.0", default-features = false, features = ["std", "read_core", "elf", "macho", "pe", "unaligned"] } -memmap = "0.7.0" +profile = { path = "../profile", version = "0.0.0" } diff --git a/crates/proc_macro_api/src/lib.rs b/crates/proc_macro_api/src/lib.rs index 2dd2a85411..654bd9943e 100644 --- a/crates/proc_macro_api/src/lib.rs +++ b/crates/proc_macro_api/src/lib.rs @@ -77,6 +77,7 @@ impl ProcMacroClient { } pub fn by_dylib_path(&self, dylib_path: &Path) -> Vec { + let _p = profile::span("ProcMacroClient::by_dylib_path"); match version::read_dylib_info(dylib_path) { Ok(info) => { if info.version.0 < 1 || info.version.1 < 47 { diff --git a/crates/rust-analyzer/src/reload.rs b/crates/rust-analyzer/src/reload.rs index e51532d880..0ae2758cc7 100644 --- a/crates/rust-analyzer/src/reload.rs +++ b/crates/rust-analyzer/src/reload.rs @@ -322,6 +322,7 @@ impl GlobalState { let loader = &mut self.loader; let mem_docs = &self.mem_docs; let mut load = |path: &AbsPath| { + let _p = profile::span("GlobalState::load"); let vfs_path = vfs::VfsPath::from(path.to_path_buf()); if !mem_docs.contains_key(&vfs_path) { let contents = loader.handle.load_sync(path);