Skip to content

Commit

Permalink
Tweak timers
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc committed Jan 9, 2020
1 parent b650e91 commit 5918c18
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/librustc_ast_lowering/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ pub fn lower_crate<'a, 'hir>(
// incr. comp. yet.
dep_graph.assert_ignored();

let _prof_timer = sess.prof.generic_activity("hir_lowering");
let _prof_timer = sess.prof.verbose_generic_activity("hir_lowering");

LoweringContext {
crate_root: sess.parse_sess.injected_crate_name.try_get().copied(),
Expand Down
1 change: 0 additions & 1 deletion src/librustc_driver/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@ pub fn run_compiler(
sess.code_stats.print_type_sizes();
}

let _timer = sess.timer("query_linker");
let linker = queries.linker()?;
Ok(Some(linker))
})?;
Expand Down
42 changes: 17 additions & 25 deletions src/librustc_interface/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,22 +163,19 @@ pub fn register_plugins<'a>(
)
});

let (krate, features) = sess.time("compute_features", || {
rustc_expand::config::features(
krate,
&sess.parse_sess,
sess.edition(),
&sess.opts.debugging_opts.allow_features,
)
});
let (krate, features) = rustc_expand::config::features(
krate,
&sess.parse_sess,
sess.edition(),
&sess.opts.debugging_opts.allow_features,
);
// these need to be set "early" so that expansion sees `quote` if enabled.
sess.init_features(features);

let crate_types = util::collect_crate_types(sess, &krate.attrs);
sess.crate_types.set(crate_types);

let disambiguator =
sess.time("compute_crate_disambiguator", || util::compute_crate_disambiguator(sess));
let disambiguator = util::compute_crate_disambiguator(sess);
sess.crate_disambiguator.set(disambiguator);
rustc_incremental::prepare_session_directory(sess, &crate_name, disambiguator);

Expand Down Expand Up @@ -726,23 +723,18 @@ pub fn create_global_ctxt<'tcx>(

let query_result_on_disk_cache = rustc_incremental::load_query_result_cache(sess);

let codegen_backend = sess.time("load_codegen_backend", || compiler.codegen_backend());
let codegen_backend = compiler.codegen_backend();
let mut local_providers = ty::query::Providers::default();
default_provide(&mut local_providers);
codegen_backend.provide(&mut local_providers);

let (local_providers, extern_providers) = sess.time("load_codegen_backend", || {
let mut local_providers = ty::query::Providers::default();
default_provide(&mut local_providers);
codegen_backend.provide(&mut local_providers);
let mut extern_providers = local_providers;
default_provide_extern(&mut extern_providers);
codegen_backend.provide_extern(&mut extern_providers);

let mut extern_providers = local_providers;
default_provide_extern(&mut extern_providers);
codegen_backend.provide_extern(&mut extern_providers);

if let Some(callback) = compiler.override_queries {
callback(sess, &mut local_providers, &mut extern_providers);
}

(local_providers, extern_providers)
});
if let Some(callback) = compiler.override_queries {
callback(sess, &mut local_providers, &mut extern_providers);
}

let gcx = sess.time("setup_global_ctxt", || {
global_ctxt.init_locking(|| {
Expand Down
1 change: 0 additions & 1 deletion src/librustc_interface/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ impl<'tcx> Queries<'tcx> {
Ok(match self.compiler.crate_name {
Some(ref crate_name) => crate_name.clone(),
None => {
let _timer = self.session().timer("crate_name");
let parse_result = self.parse()?;
let krate = parse_result.peek();
rustc_codegen_utils::link::find_crate_name(
Expand Down

0 comments on commit 5918c18

Please sign in to comment.