aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_db/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-08-12 15:36:01 +0100
committerGitHub <[email protected]>2020-08-12 15:36:01 +0100
commit147547e7b85e80e2e30aa1a5ba4d9d0969908398 (patch)
treec39749d1b71b73b4017c2d0d848ebdc85e570c39 /crates/ra_ide_db/src
parent6be5ab02008b442c85c201968b97f24f13c4692e (diff)
parent208b7bd7ba687fb570feb1b89219f14c63712ce8 (diff)
Merge #5724
5724: Rename ra_prof -> profile r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_db/src')
-rw-r--r--crates/ra_ide_db/src/change.rs8
-rw-r--r--crates/ra_ide_db/src/defs.rs5
-rw-r--r--crates/ra_ide_db/src/imports_locator.rs5
-rw-r--r--crates/ra_ide_db/src/search.rs5
-rw-r--r--crates/ra_ide_db/src/symbol_index.rs5
5 files changed, 12 insertions, 16 deletions
diff --git a/crates/ra_ide_db/src/change.rs b/crates/ra_ide_db/src/change.rs
index b13df8b85..7a4e04ca9 100644
--- a/crates/ra_ide_db/src/change.rs
+++ b/crates/ra_ide_db/src/change.rs
@@ -3,11 +3,11 @@
3 3
4use std::{fmt, sync::Arc, time}; 4use std::{fmt, sync::Arc, time};
5 5
6use profile::{memory_usage, Bytes};
6use ra_db::{ 7use ra_db::{
7 salsa::{Database, Durability, SweepStrategy}, 8 salsa::{Database, Durability, SweepStrategy},
8 CrateGraph, FileId, SourceDatabase, SourceDatabaseExt, SourceRoot, SourceRootId, 9 CrateGraph, FileId, SourceDatabase, SourceDatabaseExt, SourceRoot, SourceRootId,
9}; 10};
10use ra_prof::{memory_usage, profile, Bytes};
11use rustc_hash::FxHashSet; 11use rustc_hash::FxHashSet;
12 12
13use crate::{symbol_index::SymbolsDatabase, RootDatabase}; 13use crate::{symbol_index::SymbolsDatabase, RootDatabase};
@@ -85,12 +85,12 @@ const GC_COOLDOWN: time::Duration = time::Duration::from_millis(100);
85 85
86impl RootDatabase { 86impl RootDatabase {
87 pub fn request_cancellation(&mut self) { 87 pub fn request_cancellation(&mut self) {
88 let _p = profile("RootDatabase::request_cancellation"); 88 let _p = profile::span("RootDatabase::request_cancellation");
89 self.salsa_runtime_mut().synthetic_write(Durability::LOW); 89 self.salsa_runtime_mut().synthetic_write(Durability::LOW);
90 } 90 }
91 91
92 pub fn apply_change(&mut self, change: AnalysisChange) { 92 pub fn apply_change(&mut self, change: AnalysisChange) {
93 let _p = profile("RootDatabase::apply_change"); 93 let _p = profile::span("RootDatabase::apply_change");
94 self.request_cancellation(); 94 self.request_cancellation();
95 log::info!("apply_change {:?}", change); 95 log::info!("apply_change {:?}", change);
96 if let Some(roots) = change.roots { 96 if let Some(roots) = change.roots {
@@ -141,7 +141,7 @@ impl RootDatabase {
141 return; 141 return;
142 } 142 }
143 143
144 let _p = profile("RootDatabase::collect_garbage"); 144 let _p = profile::span("RootDatabase::collect_garbage");
145 self.last_gc = crate::wasm_shims::Instant::now(); 145 self.last_gc = crate::wasm_shims::Instant::now();
146 146
147 let sweep = SweepStrategy::default().discard_values().sweep_all_revisions(); 147 let sweep = SweepStrategy::default().discard_values().sweep_all_revisions();
diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs
index 9bb95277d..d46d1fe71 100644
--- a/crates/ra_ide_db/src/defs.rs
+++ b/crates/ra_ide_db/src/defs.rs
@@ -9,7 +9,6 @@ use hir::{
9 db::HirDatabase, Crate, Field, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, 9 db::HirDatabase, Crate, Field, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef,
10 Name, PathResolution, Semantics, TypeParam, Visibility, 10 Name, PathResolution, Semantics, TypeParam, Visibility,
11}; 11};
12use ra_prof::profile;
13use ra_syntax::{ 12use ra_syntax::{
14 ast::{self, AstNode}, 13 ast::{self, AstNode},
15 match_ast, SyntaxNode, 14 match_ast, SyntaxNode,
@@ -110,7 +109,7 @@ impl NameClass {
110} 109}
111 110
112pub fn classify_name(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option<NameClass> { 111pub fn classify_name(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option<NameClass> {
113 let _p = profile("classify_name"); 112 let _p = profile::span("classify_name");
114 113
115 let parent = name.syntax().parent()?; 114 let parent = name.syntax().parent()?;
116 115
@@ -249,7 +248,7 @@ pub fn classify_name_ref(
249 sema: &Semantics<RootDatabase>, 248 sema: &Semantics<RootDatabase>,
250 name_ref: &ast::NameRef, 249 name_ref: &ast::NameRef,
251) -> Option<NameRefClass> { 250) -> Option<NameRefClass> {
252 let _p = profile("classify_name_ref"); 251 let _p = profile::span("classify_name_ref");
253 252
254 let parent = name_ref.syntax().parent()?; 253 let parent = name_ref.syntax().parent()?;
255 254
diff --git a/crates/ra_ide_db/src/imports_locator.rs b/crates/ra_ide_db/src/imports_locator.rs
index 9e040973b..d510ce3b7 100644
--- a/crates/ra_ide_db/src/imports_locator.rs
+++ b/crates/ra_ide_db/src/imports_locator.rs
@@ -2,7 +2,6 @@
2//! Later, this should be moved away to a separate crate that is accessible from the ra_assists module. 2//! Later, this should be moved away to a separate crate that is accessible from the ra_assists module.
3 3
4use hir::{Crate, MacroDef, ModuleDef, Semantics}; 4use hir::{Crate, MacroDef, ModuleDef, Semantics};
5use ra_prof::profile;
6use ra_syntax::{ast, AstNode, SyntaxKind::NAME}; 5use ra_syntax::{ast, AstNode, SyntaxKind::NAME};
7 6
8use crate::{ 7use crate::{
@@ -18,7 +17,7 @@ pub fn find_imports<'a>(
18 krate: Crate, 17 krate: Crate,
19 name_to_import: &str, 18 name_to_import: &str,
20) -> Vec<Either<ModuleDef, MacroDef>> { 19) -> Vec<Either<ModuleDef, MacroDef>> {
21 let _p = profile("search_for_imports"); 20 let _p = profile::span("search_for_imports");
22 let db = sema.db; 21 let db = sema.db;
23 22
24 // Query dependencies first. 23 // Query dependencies first.
@@ -51,7 +50,7 @@ fn get_name_definition<'a>(
51 sema: &Semantics<'a, RootDatabase>, 50 sema: &Semantics<'a, RootDatabase>,
52 import_candidate: &FileSymbol, 51 import_candidate: &FileSymbol,
53) -> Option<Definition> { 52) -> Option<Definition> {
54 let _p = profile("get_name_definition"); 53 let _p = profile::span("get_name_definition");
55 let file_id = import_candidate.file_id; 54 let file_id = import_candidate.file_id;
56 55
57 let candidate_node = import_candidate.ptr.to_node(sema.parse(file_id).syntax()); 56 let candidate_node = import_candidate.ptr.to_node(sema.parse(file_id).syntax());
diff --git a/crates/ra_ide_db/src/search.rs b/crates/ra_ide_db/src/search.rs
index 0b862b449..d90b830d0 100644
--- a/crates/ra_ide_db/src/search.rs
+++ b/crates/ra_ide_db/src/search.rs
@@ -9,7 +9,6 @@ use std::{convert::TryInto, mem};
9use hir::{DefWithBody, HasSource, Module, ModuleSource, Semantics, Visibility}; 9use hir::{DefWithBody, HasSource, Module, ModuleSource, Semantics, Visibility};
10use once_cell::unsync::Lazy; 10use once_cell::unsync::Lazy;
11use ra_db::{FileId, FileRange, SourceDatabaseExt}; 11use ra_db::{FileId, FileRange, SourceDatabaseExt};
12use ra_prof::profile;
13use ra_syntax::{ast, match_ast, AstNode, TextRange, TextSize}; 12use ra_syntax::{ast, match_ast, AstNode, TextRange, TextSize};
14use rustc_hash::FxHashMap; 13use rustc_hash::FxHashMap;
15 14
@@ -107,7 +106,7 @@ impl IntoIterator for SearchScope {
107 106
108impl Definition { 107impl Definition {
109 fn search_scope(&self, db: &RootDatabase) -> SearchScope { 108 fn search_scope(&self, db: &RootDatabase) -> SearchScope {
110 let _p = profile("search_scope"); 109 let _p = profile::span("search_scope");
111 let module = match self.module(db) { 110 let module = match self.module(db) {
112 Some(it) => it, 111 Some(it) => it,
113 None => return SearchScope::empty(), 112 None => return SearchScope::empty(),
@@ -187,7 +186,7 @@ impl Definition {
187 sema: &Semantics<RootDatabase>, 186 sema: &Semantics<RootDatabase>,
188 search_scope: Option<SearchScope>, 187 search_scope: Option<SearchScope>,
189 ) -> Vec<Reference> { 188 ) -> Vec<Reference> {
190 let _p = profile("Definition::find_usages"); 189 let _p = profile::span("Definition::find_usages");
191 190
192 let search_scope = { 191 let search_scope = {
193 let base = self.search_scope(sema.db); 192 let base = self.search_scope(sema.db);
diff --git a/crates/ra_ide_db/src/symbol_index.rs b/crates/ra_ide_db/src/symbol_index.rs
index 35a2c5be3..6ca8bb516 100644
--- a/crates/ra_ide_db/src/symbol_index.rs
+++ b/crates/ra_ide_db/src/symbol_index.rs
@@ -34,7 +34,6 @@ use ra_db::{
34 salsa::{self, ParallelDatabase}, 34 salsa::{self, ParallelDatabase},
35 CrateId, FileId, SourceDatabaseExt, SourceRootId, 35 CrateId, FileId, SourceDatabaseExt, SourceRootId,
36}; 36};
37use ra_prof::profile;
38use ra_syntax::{ 37use ra_syntax::{
39 ast::{self, NameOwner}, 38 ast::{self, NameOwner},
40 match_ast, AstNode, Parse, SmolStr, SourceFile, 39 match_ast, AstNode, Parse, SmolStr, SourceFile,
@@ -101,7 +100,7 @@ pub trait SymbolsDatabase: hir::db::HirDatabase + SourceDatabaseExt {
101} 100}
102 101
103fn library_symbols(db: &dyn SymbolsDatabase) -> Arc<FxHashMap<SourceRootId, SymbolIndex>> { 102fn library_symbols(db: &dyn SymbolsDatabase) -> Arc<FxHashMap<SourceRootId, SymbolIndex>> {
104 let _p = profile("library_symbols"); 103 let _p = profile::span("library_symbols");
105 104
106 let roots = db.library_roots(); 105 let roots = db.library_roots();
107 let res = roots 106 let res = roots
@@ -162,7 +161,7 @@ impl<DB: ParallelDatabase> Clone for Snap<salsa::Snapshot<DB>> {
162// | VS Code | kbd:[Ctrl+T] 161// | VS Code | kbd:[Ctrl+T]
163// |=== 162// |===
164pub fn world_symbols(db: &RootDatabase, query: Query) -> Vec<FileSymbol> { 163pub fn world_symbols(db: &RootDatabase, query: Query) -> Vec<FileSymbol> {
165 let _p = ra_prof::profile("world_symbols").detail(|| query.query.clone()); 164 let _p = profile::span("world_symbols").detail(|| query.query.clone());
166 165
167 let tmp1; 166 let tmp1;
168 let tmp2; 167 let tmp2;