From f15bb3c98a76dd801d49ccf19958edaa74048b63 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 22 May 2019 11:31:07 +0300 Subject: add profile calls to parsing/expansion routines --- crates/ra_db/Cargo.toml | 1 + crates/ra_db/src/lib.rs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'crates/ra_db') diff --git a/crates/ra_db/Cargo.toml b/crates/ra_db/Cargo.toml index 08aef9bf5..5328303d2 100644 --- a/crates/ra_db/Cargo.toml +++ b/crates/ra_db/Cargo.toml @@ -12,4 +12,5 @@ parking_lot = "0.7.0" ra_arena = { path = "../ra_arena" } ra_syntax = { path = "../ra_syntax" } +ra_prof = { path = "../ra_prof" } test_utils = { path = "../test_utils" } diff --git a/crates/ra_db/src/lib.rs b/crates/ra_db/src/lib.rs index bf567721a..68b9a7143 100644 --- a/crates/ra_db/src/lib.rs +++ b/crates/ra_db/src/lib.rs @@ -6,6 +6,7 @@ use std::{panic, sync::Arc}; use ra_syntax::{TextUnit, TextRange, SourceFile, TreeArc}; use relative_path::RelativePathBuf; +use ra_prof::profile; pub use ::salsa as salsa; pub use crate::{ @@ -72,6 +73,7 @@ pub trait SourceDatabase: CheckCanceled + std::fmt::Debug { #[salsa::input] fn file_text(&self, file_id: FileId) -> Arc; // Parses the file into the syntax tree. + #[salsa::invoke(parse_query)] fn parse(&self, file_id: FileId) -> TreeArc; /// Path to a file, relative to the root of its source root. #[salsa::input] @@ -96,7 +98,8 @@ fn source_root_crates(db: &impl SourceDatabase, id: SourceRootId) -> Arc TreeArc { +fn parse_query(db: &impl SourceDatabase, file_id: FileId) -> TreeArc { + let _p = profile("parse_query"); let text = db.file_text(file_id); SourceFile::parse(&*text) } -- cgit v1.2.3