]> git.lizzy.rs Git - rust.git/commitdiff
self-profiling: Remove module names from some event-ids in codegen backend.
authorMichael Woerister <michaelwoerister@posteo>
Tue, 22 Oct 2019 10:53:46 +0000 (12:53 +0200)
committerMichael Woerister <michaelwoerister@posteo>
Tue, 22 Oct 2019 10:53:46 +0000 (12:53 +0200)
src/librustc_codegen_ssa/back/write.rs

index 8bc815f2c622ed61406cab1ac0ce2e596cf14388..762b50f1659ccd7b00a536aa78ecbe482c227eda 100644 (file)
@@ -259,7 +259,7 @@ fn generate_lto_work<B: ExtraBackendMethods>(
     needs_thin_lto: Vec<(String, B::ThinBuffer)>,
     import_only_modules: Vec<(SerializedModule<B::ModuleBuffer>, WorkProduct)>
 ) -> Vec<(WorkItem<B>, u64)> {
-    let _prof_timer = cgcx.prof.generic_activity("codegen_run_lto");
+    let _prof_timer = cgcx.prof.generic_activity("codegen_generate_lto_work");
 
     let (lto_modules, copy_jobs) = if !needs_fat_lto.is_empty() {
         assert!(needs_thin_lto.is_empty());
@@ -674,11 +674,11 @@ pub fn module_kind(&self) -> ModuleKind {
         }
     }
 
-    pub fn name(&self) -> String {
+    fn profiling_event_id(&self) -> &'static str {
         match *self {
-            WorkItem::Optimize(ref m) => format!("optimize: {}", m.name),
-            WorkItem::CopyPostLtoArtifacts(ref m) => format!("copy post LTO artifacts: {}", m.name),
-            WorkItem::LTO(ref m) => format!("lto: {}", m.name()),
+            WorkItem::Optimize(_) => "codegen_module_optimize",
+            WorkItem::CopyPostLtoArtifacts(_) => "codegen_copy_artifacts_from_incr_cache",
+            WorkItem::LTO(_) => "codegen_module_perform_lto",
         }
     }
 }
@@ -1587,7 +1587,7 @@ fn drop(&mut self) {
         // 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.name());
+            let _prof_timer = cgcx.prof.generic_activity(work.profiling_event_id());
             execute_work_item(&cgcx, work).ok()
         };
     });