diff options
author | Michal Terepeta <[email protected]> | 2020-01-03 11:50:35 +0000 |
---|---|---|
committer | Michal Terepeta <[email protected]> | 2020-01-03 11:50:35 +0000 |
commit | 100c2d01272b341b85b948da068d944b9af23ad0 (patch) | |
tree | 1b2cd8f90a91b687ddec97bab47e8e9e1bf21812 | |
parent | 4516c4c1447942a8f01b59a71dcf5abfa2c5e37a (diff) |
Add `profile` calls to {Module,Function}::diagnostics
With this change the output `ra_prof` gives a better indication where
the time is spent. Example output:
```
213ms - publish_diagnostics
213ms - diagnostics
70ms - Module::from_definition
70ms - Module::from_file
132ms - Module::diagnostics
78ms - Function::diagnostics
0ms - body_with_source_map_query (1 calls)
2ms - trait_solve_query (1 calls)
76ms - ???
15ms - Function::diagnostics
0ms - body_with_source_map_query (1 calls)
15ms - trait_solve_query (5 calls)
38ms - Function::diagnostics (51 calls)
8ms - parse_query (1 calls)
```
Signed-off-by: Michal Terepeta <[email protected]>
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 488f74cfb..cc42068a1 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -25,6 +25,7 @@ use hir_ty::{ | |||
25 | TraitEnvironment, Ty, TyDefId, TypeCtor, TypeWalk, | 25 | TraitEnvironment, Ty, TyDefId, TypeCtor, TypeWalk, |
26 | }; | 26 | }; |
27 | use ra_db::{CrateId, Edition, FileId}; | 27 | use ra_db::{CrateId, Edition, FileId}; |
28 | use ra_prof::profile; | ||
28 | use ra_syntax::ast; | 29 | use ra_syntax::ast; |
29 | 30 | ||
30 | use crate::{ | 31 | use crate::{ |
@@ -189,6 +190,7 @@ impl Module { | |||
189 | } | 190 | } |
190 | 191 | ||
191 | pub fn diagnostics(self, db: &impl HirDatabase, sink: &mut DiagnosticSink) { | 192 | pub fn diagnostics(self, db: &impl HirDatabase, sink: &mut DiagnosticSink) { |
193 | let _p = profile("Module::diagnostics"); | ||
192 | db.crate_def_map(self.id.krate).add_diagnostics(db, self.id.local_id, sink); | 194 | db.crate_def_map(self.id.krate).add_diagnostics(db, self.id.local_id, sink); |
193 | for decl in self.declarations(db) { | 195 | for decl in self.declarations(db) { |
194 | match decl { | 196 | match decl { |
@@ -507,6 +509,7 @@ impl Function { | |||
507 | } | 509 | } |
508 | 510 | ||
509 | pub fn diagnostics(self, db: &impl HirDatabase, sink: &mut DiagnosticSink) { | 511 | pub fn diagnostics(self, db: &impl HirDatabase, sink: &mut DiagnosticSink) { |
512 | let _p = profile("Function::diagnostics"); | ||
510 | let infer = db.infer(self.id.into()); | 513 | let infer = db.infer(self.id.into()); |
511 | infer.add_diagnostics(db, self.id, sink); | 514 | infer.add_diagnostics(db, self.id, sink); |
512 | let mut validator = ExprValidator::new(self.id, infer, sink); | 515 | let mut validator = ExprValidator::new(self.id, infer, sink); |