Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 206a0b5

Browse files
committed
Add timer for new items
1 parent 431dd32 commit 206a0b5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ impl flags::AnalysisStats {
201201
}
202202

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

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

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

0 commit comments

Comments
 (0)