From 208b7bd7ba687fb570feb1b89219f14c63712ce8 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 12 Aug 2020 16:32:36 +0200 Subject: Rename ra_prof -> profile --- crates/ra_ide_db/Cargo.toml | 2 +- crates/ra_ide_db/src/change.rs | 8 ++++---- crates/ra_ide_db/src/defs.rs | 5 ++--- crates/ra_ide_db/src/imports_locator.rs | 5 ++--- crates/ra_ide_db/src/search.rs | 5 ++--- crates/ra_ide_db/src/symbol_index.rs | 5 ++--- 6 files changed, 13 insertions(+), 17 deletions(-) (limited to 'crates/ra_ide_db') diff --git a/crates/ra_ide_db/Cargo.toml b/crates/ra_ide_db/Cargo.toml index 2716a38cc..92b8ef82a 100644 --- a/crates/ra_ide_db/Cargo.toml +++ b/crates/ra_ide_db/Cargo.toml @@ -24,7 +24,7 @@ stdx = { path = "../stdx" } ra_syntax = { path = "../ra_syntax" } ra_text_edit = { path = "../ra_text_edit" } ra_db = { path = "../ra_db" } -ra_prof = { path = "../ra_prof" } +profile = { path = "../profile" } test_utils = { path = "../test_utils" } # ra_ide should depend only on the top-level `hir` package. if you need 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 @@ use std::{fmt, sync::Arc, time}; +use profile::{memory_usage, Bytes}; use ra_db::{ salsa::{Database, Durability, SweepStrategy}, CrateGraph, FileId, SourceDatabase, SourceDatabaseExt, SourceRoot, SourceRootId, }; -use ra_prof::{memory_usage, profile, Bytes}; use rustc_hash::FxHashSet; use crate::{symbol_index::SymbolsDatabase, RootDatabase}; @@ -85,12 +85,12 @@ const GC_COOLDOWN: time::Duration = time::Duration::from_millis(100); impl RootDatabase { pub fn request_cancellation(&mut self) { - let _p = profile("RootDatabase::request_cancellation"); + let _p = profile::span("RootDatabase::request_cancellation"); self.salsa_runtime_mut().synthetic_write(Durability::LOW); } pub fn apply_change(&mut self, change: AnalysisChange) { - let _p = profile("RootDatabase::apply_change"); + let _p = profile::span("RootDatabase::apply_change"); self.request_cancellation(); log::info!("apply_change {:?}", change); if let Some(roots) = change.roots { @@ -141,7 +141,7 @@ impl RootDatabase { return; } - let _p = profile("RootDatabase::collect_garbage"); + let _p = profile::span("RootDatabase::collect_garbage"); self.last_gc = crate::wasm_shims::Instant::now(); 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::{ db::HirDatabase, Crate, Field, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, Name, PathResolution, Semantics, TypeParam, Visibility, }; -use ra_prof::profile; use ra_syntax::{ ast::{self, AstNode}, match_ast, SyntaxNode, @@ -110,7 +109,7 @@ impl NameClass { } pub fn classify_name(sema: &Semantics, name: &ast::Name) -> Option { - let _p = profile("classify_name"); + let _p = profile::span("classify_name"); let parent = name.syntax().parent()?; @@ -249,7 +248,7 @@ pub fn classify_name_ref( sema: &Semantics, name_ref: &ast::NameRef, ) -> Option { - let _p = profile("classify_name_ref"); + let _p = profile::span("classify_name_ref"); let parent = name_ref.syntax().parent()?; 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 @@ //! Later, this should be moved away to a separate crate that is accessible from the ra_assists module. use hir::{Crate, MacroDef, ModuleDef, Semantics}; -use ra_prof::profile; use ra_syntax::{ast, AstNode, SyntaxKind::NAME}; use crate::{ @@ -18,7 +17,7 @@ pub fn find_imports<'a>( krate: Crate, name_to_import: &str, ) -> Vec> { - let _p = profile("search_for_imports"); + let _p = profile::span("search_for_imports"); let db = sema.db; // Query dependencies first. @@ -51,7 +50,7 @@ fn get_name_definition<'a>( sema: &Semantics<'a, RootDatabase>, import_candidate: &FileSymbol, ) -> Option { - let _p = profile("get_name_definition"); + let _p = profile::span("get_name_definition"); let file_id = import_candidate.file_id; 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}; use hir::{DefWithBody, HasSource, Module, ModuleSource, Semantics, Visibility}; use once_cell::unsync::Lazy; use ra_db::{FileId, FileRange, SourceDatabaseExt}; -use ra_prof::profile; use ra_syntax::{ast, match_ast, AstNode, TextRange, TextSize}; use rustc_hash::FxHashMap; @@ -107,7 +106,7 @@ impl IntoIterator for SearchScope { impl Definition { fn search_scope(&self, db: &RootDatabase) -> SearchScope { - let _p = profile("search_scope"); + let _p = profile::span("search_scope"); let module = match self.module(db) { Some(it) => it, None => return SearchScope::empty(), @@ -187,7 +186,7 @@ impl Definition { sema: &Semantics, search_scope: Option, ) -> Vec { - let _p = profile("Definition::find_usages"); + let _p = profile::span("Definition::find_usages"); let search_scope = { 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::{ salsa::{self, ParallelDatabase}, CrateId, FileId, SourceDatabaseExt, SourceRootId, }; -use ra_prof::profile; use ra_syntax::{ ast::{self, NameOwner}, match_ast, AstNode, Parse, SmolStr, SourceFile, @@ -101,7 +100,7 @@ pub trait SymbolsDatabase: hir::db::HirDatabase + SourceDatabaseExt { } fn library_symbols(db: &dyn SymbolsDatabase) -> Arc> { - let _p = profile("library_symbols"); + let _p = profile::span("library_symbols"); let roots = db.library_roots(); let res = roots @@ -162,7 +161,7 @@ impl Clone for Snap> { // | VS Code | kbd:[Ctrl+T] // |=== pub fn world_symbols(db: &RootDatabase, query: Query) -> Vec { - let _p = ra_prof::profile("world_symbols").detail(|| query.query.clone()); + let _p = profile::span("world_symbols").detail(|| query.query.clone()); let tmp1; let tmp2; -- cgit v1.2.3