2057: add some profiling calls r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2019-10-24 07:37:52 +00:00 committed by GitHub
commit 018b621f61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View File

@ -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<FileRange> {
let _p = profile("process_definition");
let pat = name.as_str();
let scope = def.search_scope(db);
let mut refs = vec![];

View File

@ -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<NameDefinition> {
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<NameDefinition> {
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);

View File

@ -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<TextRange>)> {
let _p = profile("search_scope");
let module_src = self.container.definition_source(db);
let file_id = module_src.file_id.original_file(db);