diff options
| author | bors <bors@rust-lang.org> | 2020-02-10 22:46:29 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-02-10 22:46:29 +0000 |
| commit | 0f0cdf6acdb5a9b968728d961929ca59ff93cfa4 (patch) | |
| tree | 49bcf3b1fde98c8ed06da56145fafc574f47e60e /src/librustc_codegen_ssa | |
| parent | e6ec0d125eba4074122b187032474b4174fb9d31 (diff) | |
| parent | 119bc976db5549f17258a55bb9684eae0fa98b65 (diff) | |
Auto merge of #69030 - Dylan-DPC:rollup-t9uk7vc, r=Dylan-DPC
Rollup of 6 pull requests Successful merges: - #68897 (clean up E0275 explanation) - #68908 (Add long error code explanation message for E0637 ) - #68932 (self-profile: Support arguments for generic_activities.) - #68986 (Make ASCII ctype functions unstably const ) - #69007 (Clean up E0283 explanation) - #69014 (change an instance of span_bug() to struct_span_err() to avoid ICE) Failed merges: r? @ghost
Diffstat (limited to 'src/librustc_codegen_ssa')
| -rw-r--r-- | src/librustc_codegen_ssa/back/link.rs | 2 | ||||
| -rw-r--r-- | src/librustc_codegen_ssa/back/write.rs | 19 |
2 files changed, 14 insertions, 7 deletions
diff --git a/src/librustc_codegen_ssa/back/link.rs b/src/librustc_codegen_ssa/back/link.rs index 4f05aac0898..d3b8f7ea33f 100644 --- a/src/librustc_codegen_ssa/back/link.rs +++ b/src/librustc_codegen_ssa/back/link.rs @@ -1648,7 +1648,7 @@ fn add_upstream_rust_crates<'a, B: ArchiveBuilder<'a>>( let name = cratepath.file_name().unwrap().to_str().unwrap(); let name = &name[3..name.len() - 5]; // chop off lib/.rlib - sess.prof.extra_verbose_generic_activity(&format!("altering {}.rlib", name)).run(|| { + sess.prof.generic_activity_with_arg("link_altering_rlib", name).run(|| { let mut archive = <B as ArchiveBuilder>::new(sess, &dst, Some(cratepath)); archive.update_symbols(); diff --git a/src/librustc_codegen_ssa/back/write.rs b/src/librustc_codegen_ssa/back/write.rs index 841827d15fe..9905b3a56c0 100644 --- a/src/librustc_codegen_ssa/back/write.rs +++ b/src/librustc_codegen_ssa/back/write.rs @@ -21,6 +21,7 @@ use rustc::session::Session; use rustc::ty::TyCtxt; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::profiling::SelfProfilerRef; +use rustc_data_structures::profiling::TimingGuard; use rustc_data_structures::profiling::VerboseTimingGuard; use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::Lrc; @@ -691,11 +692,17 @@ impl<B: WriteBackendMethods> WorkItem<B> { } } - fn profiling_event_id(&self) -> &'static str { + fn start_profiling<'a>(&self, cgcx: &'a CodegenContext<B>) -> TimingGuard<'a> { match *self { - WorkItem::Optimize(_) => "codegen_module_optimize", - WorkItem::CopyPostLtoArtifacts(_) => "codegen_copy_artifacts_from_incr_cache", - WorkItem::LTO(_) => "codegen_module_perform_lto", + WorkItem::Optimize(ref m) => { + cgcx.prof.generic_activity_with_arg("codegen_module_optimize", &m.name[..]) + } + WorkItem::CopyPostLtoArtifacts(ref m) => cgcx + .prof + .generic_activity_with_arg("codegen_copy_artifacts_from_incr_cache", &m.name[..]), + WorkItem::LTO(ref m) => { + cgcx.prof.generic_activity_with_arg("codegen_module_perform_lto", m.name()) + } } } } @@ -1520,7 +1527,7 @@ fn start_executing_work<B: ExtraBackendMethods>( llvm_start_time: &mut Option<VerboseTimingGuard<'a>>, ) { if config.time_module && llvm_start_time.is_none() { - *llvm_start_time = Some(prof.extra_verbose_generic_activity("LLVM_passes")); + *llvm_start_time = Some(prof.extra_verbose_generic_activity("LLVM_passes", "crate")); } } } @@ -1575,7 +1582,7 @@ fn spawn_work<B: ExtraBackendMethods>(cgcx: CodegenContext<B>, work: WorkItem<B> // as a diagnostic was already sent off to the main thread - just // surface that there was an error in this worker. bomb.result = { - let _prof_timer = cgcx.prof.generic_activity(work.profiling_event_id()); + let _prof_timer = work.start_profiling(&cgcx); Some(execute_work_item(&cgcx, work)) }; }); |
