Skip to content

Commit

Permalink
Add timer for new items
Browse files Browse the repository at this point in the history
  • Loading branch information
HKalbasi committed May 14, 2023
1 parent 431dd32 commit 206a0b5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/rust-analyzer/src/cli/analysis_stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ impl flags::AnalysisStats {
}

fn run_data_layout(&self, db: &RootDatabase, adts: &[hir::Adt], verbosity: Verbosity) {
let mut sw = self.stop_watch();
let mut all = 0;
let mut fail = 0;
for &a in adts {
Expand All @@ -225,11 +226,13 @@ impl flags::AnalysisStats {
}
fail += 1;
}
eprintln!("{:<20} {}", "Data layouts:", sw.elapsed());
eprintln!("Failed data layouts: {fail} ({}%)", fail * 100 / all);
report_metric("failed data layouts", fail, "#");
}

fn run_const_eval(&self, db: &RootDatabase, consts: &[hir::Const], verbosity: Verbosity) {
let mut sw = self.stop_watch();
let mut all = 0;
let mut fail = 0;
for &c in consts {
Expand All @@ -250,11 +253,13 @@ impl flags::AnalysisStats {
}
fail += 1;
}
eprintln!("{:<20} {}", "Const evaluation:", sw.elapsed());
eprintln!("Failed const evals: {fail} ({}%)", fail * 100 / all);
report_metric("failed const evals", fail, "#");
}

fn run_mir_lowering(&self, db: &RootDatabase, funcs: &[Function], verbosity: Verbosity) {
let mut sw = self.stop_watch();
let all = funcs.len() as u64;
let mut fail = 0;
for f in funcs {
Expand All @@ -274,6 +279,7 @@ impl flags::AnalysisStats {
}
fail += 1;
}
eprintln!("{:<20} {}", "MIR lowering:", sw.elapsed());
eprintln!("Mir failed bodies: {fail} ({}%)", fail * 100 / all);
report_metric("mir failed bodies", fail, "#");
}
Expand Down

0 comments on commit 206a0b5

Please sign in to comment.