dump statistics about re-use w/ -Z time-passes

It's nice to get a rough idea of how much work we're
saving.
This commit is contained in:
Niko Matsakis 2016-08-01 19:56:19 -04:00
parent 2e7df80098
commit 903142aee3

View File

@ -724,6 +724,10 @@ pub fn run_passes(sess: &Session,
work_items.push(work);
}
if sess.time_passes() && sess.opts.incremental.is_some() {
dump_incremental_data(&trans);
}
// Process the work items, optionally using worker threads.
// NOTE: This code is not really adapted to incremental compilation where
// the compiler decides the number of codegen units (and will
@ -901,6 +905,17 @@ pub fn run_passes(sess: &Session,
}
}
fn dump_incremental_data(trans: &CrateTranslation) {
let mut reuse = 0;
for mtrans in trans.modules.iter() {
match mtrans.source {
ModuleSource::Preexisting(..) => reuse += 1,
ModuleSource::Translated(..) => (),
}
}
println!("incremental: re-using {} out of {} modules", reuse, trans.modules.len());
}
struct WorkItem {
mtrans: ModuleTranslation,
config: ModuleConfig,