Skip to content

Commit 756c424

Browse files
committed
analysis-stats: always print source stats
1 parent 6af7291 commit 756c424

File tree

2 files changed

+20
-27
lines changed

2 files changed

+20
-27
lines changed

crates/rust-analyzer/src/cli/analysis_stats.rs

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ impl flags::AnalysisStats {
141141

142142
workspace_loc += length;
143143
workspace_item_trees += 1;
144-
} else if self.source_stats {
144+
} else {
145145
let length = db.file_text(file_id).text(db).lines().count();
146146
db.file_item_tree(EditionedFileId::current_edition(file_id).into());
147147

@@ -155,29 +155,25 @@ impl flags::AnalysisStats {
155155
eprintln!(" item trees: {workspace_item_trees}");
156156
let item_tree_time = item_tree_sw.elapsed();
157157

158-
if self.source_stats {
159-
eprintln!("Source stats:");
160-
eprintln!(" dependency lines of code: {dep_loc}, item trees: {deps_item_trees}");
161-
eprintln!(
162-
" workspace lines of code: {workspace_loc}, item trees: {workspace_item_trees}"
163-
);
158+
eprintln!("Source stats:");
159+
eprintln!(" dependency lines of code: {dep_loc}, item trees: {deps_item_trees}");
160+
eprintln!(" workspace lines of code: {workspace_loc}, item trees: {workspace_item_trees}");
164161

165-
// FIXME(salsa-transition): bring back stats for ParseQuery (file size)
166-
// and ParseMacroExpansionQuery (mcaro expansion "file") size whenever we implement
167-
// Salsa's memory usage tracking works with tracked functions.
168-
169-
// let mut total_file_size = Bytes::default();
170-
// for e in ide_db::base_db::ParseQuery.in_db(db).entries::<Vec<_>>() {
171-
// total_file_size += syntax_len(db.parse(e.key).syntax_node())
172-
// }
173-
174-
// let mut total_macro_file_size = Bytes::default();
175-
// for e in hir::db::ParseMacroExpansionQuery.in_db(db).entries::<Vec<_>>() {
176-
// let val = db.parse_macro_expansion(e.key).value.0;
177-
// total_macro_file_size += syntax_len(val.syntax_node())
178-
// }
179-
// eprintln!("source files: {total_file_size}, macro files: {total_macro_file_size}");
180-
}
162+
// FIXME(salsa-transition): bring back stats for ParseQuery (file size)
163+
// and ParseMacroExpansionQuery (mcaro expansion "file") size whenever we implement
164+
// Salsa's memory usage tracking works with tracked functions.
165+
166+
// let mut total_file_size = Bytes::default();
167+
// for e in ide_db::base_db::ParseQuery.in_db(db).entries::<Vec<_>>() {
168+
// total_file_size += syntax_len(db.parse(e.key).syntax_node())
169+
// }
170+
171+
// let mut total_macro_file_size = Bytes::default();
172+
// for e in hir::db::ParseMacroExpansionQuery.in_db(db).entries::<Vec<_>>() {
173+
// let val = db.parse_macro_expansion(e.key).value.0;
174+
// total_macro_file_size += syntax_len(val.syntax_node())
175+
// }
176+
// eprintln!("source files: {total_file_size}, macro files: {total_macro_file_size}");
181177

182178
eprintln!("{:<20} {}", "Item Tree Collection:", item_tree_time);
183179
report_metric("item tree time", item_tree_time.time.as_millis() as u64, "ms");
@@ -261,7 +257,7 @@ impl flags::AnalysisStats {
261257
}
262258
}
263259
eprintln!(
264-
", mods: {}, decls: {num_decls}, bodies: {}, adts: {}, consts: {}",
260+
", mods: {}, decls: {num_decls}, bodies: {}, adts: {}, consts: {},",
265261
visited_modules.len(),
266262
bodies.len(),
267263
adts.len(),

crates/rust-analyzer/src/cli/flags.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ xflags::xflags! {
6262
optional --randomize
6363
/// Run type inference in parallel.
6464
optional --parallel
65-
/// Print the total length of all source and macro files (whitespace is not counted).
66-
optional --source-stats
6765

6866
/// Only analyze items matching this path.
6967
optional -o, --only path: String
@@ -231,7 +229,6 @@ pub struct AnalysisStats {
231229
pub output: Option<OutputFormat>,
232230
pub randomize: bool,
233231
pub parallel: bool,
234-
pub source_stats: bool,
235232
pub only: Option<String>,
236233
pub with_deps: bool,
237234
pub no_sysroot: bool,

0 commit comments

Comments
 (0)