Rollup merge of #58507 - Zoxc:time-extended, r=michaelwoerister
Add a -Z time option which prints only passes which runs once This ensures `-Z time-passes` fits on my screen =P r? @michaelwoerister
This commit is contained in:
commit
9f9529acd5
@ -1200,6 +1200,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
|
||||
"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 \
|
||||
|
@ -504,6 +504,9 @@ impl Session {
|
||||
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 {
|
||||
|
@ -12,7 +12,7 @@ use crate::session::{CrateDisambiguator, Session};
|
||||
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;
|
||||
@ -1080,23 +1080,22 @@ fn encode_query_results<'enc, 'a, 'tcx, Q, E>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
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(())
|
||||
})
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ use rustc::session::Session;
|
||||
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};
|
||||
@ -1319,7 +1319,7 @@ fn add_upstream_rust_crates(cmd: &mut dyn Linker,
|
||||
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();
|
||||
|
@ -125,7 +125,7 @@ impl ModuleConfig {
|
||||
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();
|
||||
@ -1091,7 +1091,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
|
||||
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(),
|
||||
|
@ -403,8 +403,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
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),
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user