From ac1b7b07e770652bad72f024efebfd5790a509c3 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 24 Oct 2019 10:37:20 +0300 Subject: add some profiling calls --- crates/ra_ide_api/src/references.rs | 3 +++ crates/ra_ide_api/src/references/classify.rs | 4 ++++ crates/ra_ide_api/src/references/search_scope.rs | 3 +++ 3 files changed, 10 insertions(+) (limited to 'crates') diff --git a/crates/ra_ide_api/src/references.rs b/crates/ra_ide_api/src/references.rs index f35d835ac..8200bd1ef 100644 --- a/crates/ra_ide_api/src/references.rs +++ b/crates/ra_ide_api/src/references.rs @@ -16,6 +16,7 @@ mod search_scope; use once_cell::unsync::Lazy; use ra_db::{SourceDatabase, SourceDatabaseExt}; +use ra_prof::profile; use ra_syntax::{algo::find_node_at_offset, ast, AstNode, SourceFile, SyntaxNode, TextUnit}; use crate::{db::RootDatabase, FilePosition, FileRange, NavigationTarget, RangeInfo}; @@ -107,6 +108,8 @@ fn find_name<'a>( } fn process_definition(db: &RootDatabase, def: NameDefinition, name: String) -> Vec { + let _p = profile("process_definition"); + let pat = name.as_str(); let scope = def.search_scope(db); let mut refs = vec![]; diff --git a/crates/ra_ide_api/src/references/classify.rs b/crates/ra_ide_api/src/references/classify.rs index c8daff9b1..153082d5b 100644 --- a/crates/ra_ide_api/src/references/classify.rs +++ b/crates/ra_ide_api/src/references/classify.rs @@ -2,6 +2,7 @@ use hir::{Either, FromSource, Module, ModuleSource, Path, PathResolution, Source, SourceAnalyzer}; use ra_db::FileId; +use ra_prof::profile; use ra_syntax::{ast, match_ast, AstNode, AstPtr}; use test_utils::tested_by; @@ -16,6 +17,7 @@ pub(crate) fn classify_name( file_id: FileId, name: &ast::Name, ) -> Option { + let _p = profile("classify_name"); let parent = name.syntax().parent()?; let file_id = file_id.into(); @@ -108,6 +110,8 @@ pub(crate) fn classify_name_ref( ) -> Option { use PathResolution::*; + let _p = profile("classify_name_ref"); + let parent = name_ref.syntax().parent()?; let analyzer = SourceAnalyzer::new(db, file_id, name_ref.syntax(), None); diff --git a/crates/ra_ide_api/src/references/search_scope.rs b/crates/ra_ide_api/src/references/search_scope.rs index 5cb69b8fc..21e667c83 100644 --- a/crates/ra_ide_api/src/references/search_scope.rs +++ b/crates/ra_ide_api/src/references/search_scope.rs @@ -5,6 +5,7 @@ use hir::{DefWithBody, HasSource, ModuleSource}; use ra_db::{FileId, SourceDatabase, SourceDatabaseExt}; +use ra_prof::profile; use ra_syntax::{AstNode, TextRange}; use rustc_hash::FxHashSet; @@ -14,6 +15,8 @@ use super::{NameDefinition, NameKind}; impl NameDefinition { pub(crate) fn search_scope(&self, db: &RootDatabase) -> FxHashSet<(FileId, Option)> { + let _p = profile("search_scope"); + let module_src = self.container.definition_source(db); let file_id = module_src.file_id.original_file(db); -- cgit v1.2.3