"when using two-phase-borrows, allow two phases even for non-autoref `&mut` borrows"),
time_passes: bool = (false, parse_bool, [UNTRACKED],
"measure time of each rustc pass"),
+ time: bool = (false, parse_bool, [UNTRACKED],
+ "measure time of rustc processes"),
count_llvm_insns: bool = (false, parse_bool,
[UNTRACKED_WITH_WARNING(true,
"The output generated by `-Z count_llvm_insns` might not be reliable \
self.opts.debugging_opts.verbose
}
pub fn time_passes(&self) -> bool {
+ self.opts.debugging_opts.time_passes || self.opts.debugging_opts.time
+ }
+ pub fn time_extended(&self) -> bool {
self.opts.debugging_opts.time_passes
}
pub fn profile_queries(&self) -> bool {
use crate::ty;
use crate::ty::codec::{self as ty_codec, TyDecoder, TyEncoder};
use crate::ty::context::TyCtxt;
-use crate::util::common::time;
+use crate::util::common::{time, time_ext};
use errors::Diagnostic;
use rustc_data_structures::fx::FxHashMap;
let desc = &format!("encode_query_results for {}",
unsafe { ::std::intrinsics::type_name::<Q>() });
- time(tcx.sess, desc, || {
+ time_ext(tcx.sess.time_extended(), Some(tcx.sess), desc, || {
+ let map = Q::query_cache(tcx).borrow();
+ assert!(map.active.is_empty());
+ for (key, entry) in map.results.iter() {
+ if Q::cache_on_disk(tcx, key.clone()) {
+ let dep_node = SerializedDepNodeIndex::new(entry.index.index());
- let map = Q::query_cache(tcx).borrow();
- assert!(map.active.is_empty());
- for (key, entry) in map.results.iter() {
- if Q::cache_on_disk(tcx, key.clone()) {
- let dep_node = SerializedDepNodeIndex::new(entry.index.index());
+ // Record position of the cache entry
+ query_result_index.push((dep_node, AbsoluteBytePos::new(encoder.position())));
- // Record position of the cache entry
- query_result_index.push((dep_node, AbsoluteBytePos::new(encoder.position())));
-
- // Encode the type check tables with the SerializedDepNodeIndex
- // as tag.
- encoder.encode_tagged(dep_node, &entry.value)?;
+ // Encode the type check tables with the SerializedDepNodeIndex
+ // as tag.
+ encoder.encode_tagged(dep_node, &entry.value)?;
+ }
}
- }
- Ok(())
+ Ok(())
})
}
use rustc::middle::cstore::{NativeLibrary, NativeLibraryKind};
use rustc::middle::dependency_format::Linkage;
use rustc_codegen_ssa::CodegenResults;
-use rustc::util::common::time;
+use rustc::util::common::{time, time_ext};
use rustc_fs_util::fix_windows_verbatim_for_gcc;
use rustc::hir::def_id::CrateNum;
use tempfile::{Builder as TempFileBuilder, TempDir};
let name = cratepath.file_name().unwrap().to_str().unwrap();
let name = &name[3..name.len() - 5]; // chop off lib/.rlib
- time(sess, &format!("altering {}.rlib", name), || {
+ time_ext(sess.time_extended(), Some(sess), &format!("altering {}.rlib", name), || {
let cfg = archive_config(sess, &dst, Some(cratepath));
let mut archive = ArchiveBuilder::new(cfg);
archive.update_symbols();
self.verify_llvm_ir = sess.verify_llvm_ir();
self.no_prepopulate_passes = sess.opts.cg.no_prepopulate_passes;
self.no_builtins = no_builtins || sess.target.target.options.no_builtins;
- self.time_passes = sess.time_passes();
+ self.time_passes = sess.time_extended();
self.inline_threshold = sess.opts.cg.inline_threshold;
self.obj_is_bitcode = sess.target.target.options.obj_is_bitcode ||
sess.opts.cg.linker_plugin_lto.enabled();
fewer_names: sess.fewer_names(),
save_temps: sess.opts.cg.save_temps,
opts: Arc::new(sess.opts.clone()),
- time_passes: sess.time_passes(),
+ time_passes: sess.time_extended(),
profiler: sess.self_profiling.clone(),
exported_symbols,
plugin_passes: sess.plugin_llvm_passes.borrow().clone(),
mir_def_id: DefId,
errors_buffer: &mut Vec<Diagnostic>,
) -> Option<ClosureRegionRequirements<'gcx>> {
- common::time(
- infcx.tcx.sess,
+ common::time_ext(
+ infcx.tcx.sess.time_extended(),
+ Some(infcx.tcx.sess),
&format!("solve_nll_region_constraints({:?})", mir_def_id),
|| self.solve_inner(infcx, mir, mir_def_id, errors_buffer),
)