aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-07-10 17:53:01 +0100
committerAleksey Kladov <[email protected]>2020-07-10 21:30:24 +0100
commitbe679a02aba985ee458dd8441606bff0595a2ce2 (patch)
treeaf12bda2111b5b7913354c2ebde0d6dcb7c7f9b6
parent86bc4d20b30b8deb7783c200ad9f5d3acf019116 (diff)
Add profiling calls
-rw-r--r--crates/rust-analyzer/src/global_state.rs2
-rw-r--r--crates/rust-analyzer/src/reload.rs4
2 files changed, 6 insertions, 0 deletions
diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs
index 728dc9962..9a9a6547a 100644
--- a/crates/rust-analyzer/src/global_state.rs
+++ b/crates/rust-analyzer/src/global_state.rs
@@ -26,6 +26,7 @@ use crate::{
26 to_proto::url_from_abs_path, 26 to_proto::url_from_abs_path,
27 Result, 27 Result,
28}; 28};
29use ra_prof::profile;
29 30
30#[derive(Eq, PartialEq, Copy, Clone)] 31#[derive(Eq, PartialEq, Copy, Clone)]
31pub(crate) enum Status { 32pub(crate) enum Status {
@@ -122,6 +123,7 @@ impl GlobalState {
122 } 123 }
123 124
124 pub(crate) fn process_changes(&mut self) -> bool { 125 pub(crate) fn process_changes(&mut self) -> bool {
126 let _p = profile("GlobalState::process_changes");
125 let mut fs_changes = Vec::new(); 127 let mut fs_changes = Vec::new();
126 let mut has_fs_changes = false; 128 let mut has_fs_changes = false;
127 129
diff --git a/crates/rust-analyzer/src/reload.rs b/crates/rust-analyzer/src/reload.rs
index a425320f6..ffe234a5b 100644
--- a/crates/rust-analyzer/src/reload.rs
+++ b/crates/rust-analyzer/src/reload.rs
@@ -14,9 +14,11 @@ use crate::{
14 lsp_ext, 14 lsp_ext,
15 main_loop::Task, 15 main_loop::Task,
16}; 16};
17use ra_prof::profile;
17 18
18impl GlobalState { 19impl GlobalState {
19 pub(crate) fn update_configuration(&mut self, config: Config) { 20 pub(crate) fn update_configuration(&mut self, config: Config) {
21 let _p = profile("GlobalState::update_configuration");
20 let old_config = mem::replace(&mut self.config, config); 22 let old_config = mem::replace(&mut self.config, config);
21 if self.config.lru_capacity != old_config.lru_capacity { 23 if self.config.lru_capacity != old_config.lru_capacity {
22 self.analysis_host.update_lru_capacity(old_config.lru_capacity); 24 self.analysis_host.update_lru_capacity(old_config.lru_capacity);
@@ -114,6 +116,7 @@ impl GlobalState {
114 }); 116 });
115 } 117 }
116 pub(crate) fn switch_workspaces(&mut self, workspaces: Vec<anyhow::Result<ProjectWorkspace>>) { 118 pub(crate) fn switch_workspaces(&mut self, workspaces: Vec<anyhow::Result<ProjectWorkspace>>) {
119 let _p = profile("GlobalState::switch_workspaces");
117 log::info!("reloading projects: {:?}", self.config.linked_projects); 120 log::info!("reloading projects: {:?}", self.config.linked_projects);
118 121
119 let mut has_errors = false; 122 let mut has_errors = false;
@@ -302,6 +305,7 @@ pub(crate) struct SourceRootConfig {
302 305
303impl SourceRootConfig { 306impl SourceRootConfig {
304 pub(crate) fn partition(&self, vfs: &vfs::Vfs) -> Vec<SourceRoot> { 307 pub(crate) fn partition(&self, vfs: &vfs::Vfs) -> Vec<SourceRoot> {
308 let _p = profile("SourceRootConfig::partition");
305 self.fsc 309 self.fsc
306 .partition(vfs) 310 .partition(vfs)
307 .into_iter() 311 .into_iter()