analysis-stats: always print source stats

This commit is contained in:
David Barsky 2025-03-14 15:27:56 -04:00
parent 6af729166e
commit 756c42409c
2 changed files with 18 additions and 25 deletions

View file

@ -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,12 +155,9 @@ 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!(" 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
@ -177,7 +174,6 @@ impl flags::AnalysisStats {
// 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(),

View file

@ -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,