From 8ee9322c1041bcbaee408961727c4418bd792979 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Tue, 23 Mar 2021 13:19:42 +0100 Subject: [PATCH] Also profile finishing the encoding. --- compiler/rustc_incremental/src/persist/save.rs | 2 +- compiler/rustc_query_system/src/dep_graph/graph.rs | 8 ++++++-- compiler/rustc_query_system/src/dep_graph/serialized.rs | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_incremental/src/persist/save.rs b/compiler/rustc_incremental/src/persist/save.rs index 23bd63a37d637..d558af3c1d558 100644 --- a/compiler/rustc_incremental/src/persist/save.rs +++ b/compiler/rustc_incremental/src/persist/save.rs @@ -49,7 +49,7 @@ pub fn save_dep_graph(tcx: TyCtxt<'_>) { }, move || { sess.time("incr_comp_persist_dep_graph", || { - if let Err(err) = tcx.dep_graph.encode() { + if let Err(err) = tcx.dep_graph.encode(&tcx.sess.prof) { sess.err(&format!( "failed to write dependency graph to `{}`: {}", staging_dep_graph_path.display(), diff --git a/compiler/rustc_query_system/src/dep_graph/graph.rs b/compiler/rustc_query_system/src/dep_graph/graph.rs index f92ee85f62e69..7a0fc320663f7 100644 --- a/compiler/rustc_query_system/src/dep_graph/graph.rs +++ b/compiler/rustc_query_system/src/dep_graph/graph.rs @@ -789,8 +789,12 @@ impl DepGraph { } } - pub fn encode(&self) -> FileEncodeResult { - if let Some(data) = &self.data { data.current.encoder.steal().finish() } else { Ok(()) } + pub fn encode(&self, profiler: &SelfProfilerRef) -> FileEncodeResult { + if let Some(data) = &self.data { + data.current.encoder.steal().finish(profiler) + } else { + Ok(()) + } } fn next_virtual_depnode_index(&self) -> DepNodeIndex { diff --git a/compiler/rustc_query_system/src/dep_graph/serialized.rs b/compiler/rustc_query_system/src/dep_graph/serialized.rs index 27f7e5730a7a2..1e34b14d9060f 100644 --- a/compiler/rustc_query_system/src/dep_graph/serialized.rs +++ b/compiler/rustc_query_system/src/dep_graph/serialized.rs @@ -304,7 +304,8 @@ impl> GraphEncoder { self.status.lock().encode_node(&node, &self.record_graph) } - pub fn finish(self) -> FileEncodeResult { + pub fn finish(self, profiler: &SelfProfilerRef) -> FileEncodeResult { + let _prof_timer = profiler.generic_activity("incr_comp_encode_dep_graph"); self.status.into_inner().finish() } }