diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-10-24 08:37:52 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-10-24 08:37:52 +0100 |
commit | 018b621f613e87af26d8f7880ea1012cb374216c (patch) | |
tree | c2f9015026a295d17b792e917c1b42b09f933a57 /crates/ra_ide_api/src | |
parent | 778f50b1477ad3c33cd6220f71bac7b83a66176a (diff) | |
parent | ac1b7b07e770652bad72f024efebfd5790a509c3 (diff) |
Merge #2057
2057: add some profiling calls r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r-- | crates/ra_ide_api/src/references.rs | 3 | ||||
-rw-r--r-- | crates/ra_ide_api/src/references/classify.rs | 4 | ||||
-rw-r--r-- | crates/ra_ide_api/src/references/search_scope.rs | 3 |
3 files changed, 10 insertions, 0 deletions
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; | |||
16 | 16 | ||
17 | use once_cell::unsync::Lazy; | 17 | use once_cell::unsync::Lazy; |
18 | use ra_db::{SourceDatabase, SourceDatabaseExt}; | 18 | use ra_db::{SourceDatabase, SourceDatabaseExt}; |
19 | use ra_prof::profile; | ||
19 | use ra_syntax::{algo::find_node_at_offset, ast, AstNode, SourceFile, SyntaxNode, TextUnit}; | 20 | use ra_syntax::{algo::find_node_at_offset, ast, AstNode, SourceFile, SyntaxNode, TextUnit}; |
20 | 21 | ||
21 | use crate::{db::RootDatabase, FilePosition, FileRange, NavigationTarget, RangeInfo}; | 22 | use crate::{db::RootDatabase, FilePosition, FileRange, NavigationTarget, RangeInfo}; |
@@ -107,6 +108,8 @@ fn find_name<'a>( | |||
107 | } | 108 | } |
108 | 109 | ||
109 | fn process_definition(db: &RootDatabase, def: NameDefinition, name: String) -> Vec<FileRange> { | 110 | fn process_definition(db: &RootDatabase, def: NameDefinition, name: String) -> Vec<FileRange> { |
111 | let _p = profile("process_definition"); | ||
112 | |||
110 | let pat = name.as_str(); | 113 | let pat = name.as_str(); |
111 | let scope = def.search_scope(db); | 114 | let scope = def.search_scope(db); |
112 | let mut refs = vec![]; | 115 | 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 @@ | |||
2 | 2 | ||
3 | use hir::{Either, FromSource, Module, ModuleSource, Path, PathResolution, Source, SourceAnalyzer}; | 3 | use hir::{Either, FromSource, Module, ModuleSource, Path, PathResolution, Source, SourceAnalyzer}; |
4 | use ra_db::FileId; | 4 | use ra_db::FileId; |
5 | use ra_prof::profile; | ||
5 | use ra_syntax::{ast, match_ast, AstNode, AstPtr}; | 6 | use ra_syntax::{ast, match_ast, AstNode, AstPtr}; |
6 | use test_utils::tested_by; | 7 | use test_utils::tested_by; |
7 | 8 | ||
@@ -16,6 +17,7 @@ pub(crate) fn classify_name( | |||
16 | file_id: FileId, | 17 | file_id: FileId, |
17 | name: &ast::Name, | 18 | name: &ast::Name, |
18 | ) -> Option<NameDefinition> { | 19 | ) -> Option<NameDefinition> { |
20 | let _p = profile("classify_name"); | ||
19 | let parent = name.syntax().parent()?; | 21 | let parent = name.syntax().parent()?; |
20 | let file_id = file_id.into(); | 22 | let file_id = file_id.into(); |
21 | 23 | ||
@@ -108,6 +110,8 @@ pub(crate) fn classify_name_ref( | |||
108 | ) -> Option<NameDefinition> { | 110 | ) -> Option<NameDefinition> { |
109 | use PathResolution::*; | 111 | use PathResolution::*; |
110 | 112 | ||
113 | let _p = profile("classify_name_ref"); | ||
114 | |||
111 | let parent = name_ref.syntax().parent()?; | 115 | let parent = name_ref.syntax().parent()?; |
112 | let analyzer = SourceAnalyzer::new(db, file_id, name_ref.syntax(), None); | 116 | let analyzer = SourceAnalyzer::new(db, file_id, name_ref.syntax(), None); |
113 | 117 | ||
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 @@ | |||
5 | 5 | ||
6 | use hir::{DefWithBody, HasSource, ModuleSource}; | 6 | use hir::{DefWithBody, HasSource, ModuleSource}; |
7 | use ra_db::{FileId, SourceDatabase, SourceDatabaseExt}; | 7 | use ra_db::{FileId, SourceDatabase, SourceDatabaseExt}; |
8 | use ra_prof::profile; | ||
8 | use ra_syntax::{AstNode, TextRange}; | 9 | use ra_syntax::{AstNode, TextRange}; |
9 | use rustc_hash::FxHashSet; | 10 | use rustc_hash::FxHashSet; |
10 | 11 | ||
@@ -14,6 +15,8 @@ use super::{NameDefinition, NameKind}; | |||
14 | 15 | ||
15 | impl NameDefinition { | 16 | impl NameDefinition { |
16 | pub(crate) fn search_scope(&self, db: &RootDatabase) -> FxHashSet<(FileId, Option<TextRange>)> { | 17 | pub(crate) fn search_scope(&self, db: &RootDatabase) -> FxHashSet<(FileId, Option<TextRange>)> { |
18 | let _p = profile("search_scope"); | ||
19 | |||
17 | let module_src = self.container.definition_source(db); | 20 | let module_src = self.container.definition_source(db); |
18 | let file_id = module_src.file_id.original_file(db); | 21 | let file_id = module_src.file_id.original_file(db); |
19 | 22 | ||