diff options
| author | David Barsky <me@davidbarsky.com> | 2025-03-14 15:27:56 -0400 |
|---|---|---|
| committer | David Barsky <me@davidbarsky.com> | 2025-03-24 09:59:51 -0700 |
| commit | efe3fe76ea699b51c4da6e6c98c0b03b1eddb59f (patch) | |
| tree | d2a4ae0861d5ad658f025ed5bdac4e39e03a63b6 | |
| parent | 22624ade4891a203971b53a900501a92d612f1fe (diff) | |
| download | rust-efe3fe76ea699b51c4da6e6c98c0b03b1eddb59f.tar.gz rust-efe3fe76ea699b51c4da6e6c98c0b03b1eddb59f.zip | |
analysis-stats: always print source stats
| -rw-r--r-- | src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs | 44 | ||||
| -rw-r--r-- | src/tools/rust-analyzer/crates/rust-analyzer/src/cli/flags.rs | 3 |
2 files changed, 20 insertions, 27 deletions
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs index 74d79131884..97a319f0312 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs @@ -141,7 +141,7 @@ impl flags::AnalysisStats { workspace_loc += length; workspace_item_trees += 1; - } else if self.source_stats { + } else { let length = db.file_text(file_id).text(db).lines().count(); db.file_item_tree(EditionedFileId::current_edition(file_id).into()); @@ -155,29 +155,25 @@ impl flags::AnalysisStats { eprintln!(" item trees: {workspace_item_trees}"); let item_tree_time = item_tree_sw.elapsed(); - if self.source_stats { - eprintln!("Source stats:"); - eprintln!(" dependency lines of code: {dep_loc}, item trees: {deps_item_trees}"); - eprintln!( - " workspace lines of code: {workspace_loc}, item trees: {workspace_item_trees}" - ); + eprintln!("Source stats:"); + eprintln!(" dependency lines of code: {dep_loc}, item trees: {deps_item_trees}"); + eprintln!(" workspace lines of code: {workspace_loc}, item trees: {workspace_item_trees}"); - // FIXME(salsa-transition): bring back stats for ParseQuery (file size) - // and ParseMacroExpansionQuery (mcaro expansion "file") size whenever we implement - // Salsa's memory usage tracking works with tracked functions. - - // let mut total_file_size = Bytes::default(); - // for e in ide_db::base_db::ParseQuery.in_db(db).entries::<Vec<_>>() { - // total_file_size += syntax_len(db.parse(e.key).syntax_node()) - // } - - // let mut total_macro_file_size = Bytes::default(); - // for e in hir::db::ParseMacroExpansionQuery.in_db(db).entries::<Vec<_>>() { - // let val = db.parse_macro_expansion(e.key).value.0; - // total_macro_file_size += syntax_len(val.syntax_node()) - // } - // eprintln!("source files: {total_file_size}, macro files: {total_macro_file_size}"); - } + // FIXME(salsa-transition): bring back stats for ParseQuery (file size) + // and ParseMacroExpansionQuery (mcaro expansion "file") size whenever we implement + // Salsa's memory usage tracking works with tracked functions. + + // let mut total_file_size = Bytes::default(); + // for e in ide_db::base_db::ParseQuery.in_db(db).entries::<Vec<_>>() { + // total_file_size += syntax_len(db.parse(e.key).syntax_node()) + // } + + // let mut total_macro_file_size = Bytes::default(); + // for e in hir::db::ParseMacroExpansionQuery.in_db(db).entries::<Vec<_>>() { + // let val = db.parse_macro_expansion(e.key).value.0; + // total_macro_file_size += syntax_len(val.syntax_node()) + // } + // eprintln!("source files: {total_file_size}, macro files: {total_macro_file_size}"); eprintln!("{:<20} {}", "Item Tree Collection:", item_tree_time); report_metric("item tree time", item_tree_time.time.as_millis() as u64, "ms"); @@ -261,7 +257,7 @@ impl flags::AnalysisStats { } } eprintln!( - ", mods: {}, decls: {num_decls}, bodies: {}, adts: {}, consts: {}", + ", mods: {}, decls: {num_decls}, bodies: {}, adts: {}, consts: {},", visited_modules.len(), bodies.len(), adts.len(), diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/flags.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/flags.rs index ff24602144a..13075d49942 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/flags.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/flags.rs @@ -62,8 +62,6 @@ xflags::xflags! { optional --randomize /// Run type inference in parallel. optional --parallel - /// Print the total length of all source and macro files (whitespace is not counted). - optional --source-stats /// Only analyze items matching this path. optional -o, --only path: String @@ -231,7 +229,6 @@ pub struct AnalysisStats { pub output: Option<OutputFormat>, pub randomize: bool, pub parallel: bool, - pub source_stats: bool, pub only: Option<String>, pub with_deps: bool, pub no_sysroot: bool, |
