Skip to content

Commit 903142a

Browse files
committed
dump statistics about re-use w/ -Z time-passes
It's nice to get a rough idea of how much work we're saving.
1 parent 2e7df80 commit 903142a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/librustc_trans/back/write.rs

+15
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,10 @@ pub fn run_passes(sess: &Session,
724724
work_items.push(work);
725725
}
726726

727+
if sess.time_passes() && sess.opts.incremental.is_some() {
728+
dump_incremental_data(&trans);
729+
}
730+
727731
// Process the work items, optionally using worker threads.
728732
// NOTE: This code is not really adapted to incremental compilation where
729733
// the compiler decides the number of codegen units (and will
@@ -901,6 +905,17 @@ pub fn run_passes(sess: &Session,
901905
}
902906
}
903907

908+
fn dump_incremental_data(trans: &CrateTranslation) {
909+
let mut reuse = 0;
910+
for mtrans in trans.modules.iter() {
911+
match mtrans.source {
912+
ModuleSource::Preexisting(..) => reuse += 1,
913+
ModuleSource::Translated(..) => (),
914+
}
915+
}
916+
println!("incremental: re-using {} out of {} modules", reuse, trans.modules.len());
917+
}
918+
904919
struct WorkItem {
905920
mtrans: ModuleTranslation,
906921
config: ModuleConfig,

0 commit comments

Comments
 (0)