Add profiling calls

This commit is contained in:
Aleksey Kladov 2020-07-10 18:53:01 +02:00
parent 86bc4d20b3
commit be679a02ab
2 changed files with 6 additions and 0 deletions

View file

@ -26,6 +26,7 @@ use crate::{
to_proto::url_from_abs_path,
Result,
};
use ra_prof::profile;
#[derive(Eq, PartialEq, Copy, Clone)]
pub(crate) enum Status {
@ -122,6 +123,7 @@ impl GlobalState {
}
pub(crate) fn process_changes(&mut self) -> bool {
let _p = profile("GlobalState::process_changes");
let mut fs_changes = Vec::new();
let mut has_fs_changes = false;

View file

@ -14,9 +14,11 @@ use crate::{
lsp_ext,
main_loop::Task,
};
use ra_prof::profile;
impl GlobalState {
pub(crate) fn update_configuration(&mut self, config: Config) {
let _p = profile("GlobalState::update_configuration");
let old_config = mem::replace(&mut self.config, config);
if self.config.lru_capacity != old_config.lru_capacity {
self.analysis_host.update_lru_capacity(old_config.lru_capacity);
@ -114,6 +116,7 @@ impl GlobalState {
});
}
pub(crate) fn switch_workspaces(&mut self, workspaces: Vec<anyhow::Result<ProjectWorkspace>>) {
let _p = profile("GlobalState::switch_workspaces");
log::info!("reloading projects: {:?}", self.config.linked_projects);
let mut has_errors = false;
@ -302,6 +305,7 @@ pub(crate) struct SourceRootConfig {
impl SourceRootConfig {
pub(crate) fn partition(&self, vfs: &vfs::Vfs) -> Vec<SourceRoot> {
let _p = profile("SourceRootConfig::partition");
self.fsc
.partition(vfs)
.into_iter()