Skip to content

Commit 8ee9322

Browse files
committed
Also profile finishing the encoding.
1 parent df24315 commit 8ee9322

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

compiler/rustc_incremental/src/persist/save.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub fn save_dep_graph(tcx: TyCtxt<'_>) {
4949
},
5050
move || {
5151
sess.time("incr_comp_persist_dep_graph", || {
52-
if let Err(err) = tcx.dep_graph.encode() {
52+
if let Err(err) = tcx.dep_graph.encode(&tcx.sess.prof) {
5353
sess.err(&format!(
5454
"failed to write dependency graph to `{}`: {}",
5555
staging_dep_graph_path.display(),

compiler/rustc_query_system/src/dep_graph/graph.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -789,8 +789,12 @@ impl<K: DepKind> DepGraph<K> {
789789
}
790790
}
791791

792-
pub fn encode(&self) -> FileEncodeResult {
793-
if let Some(data) = &self.data { data.current.encoder.steal().finish() } else { Ok(()) }
792+
pub fn encode(&self, profiler: &SelfProfilerRef) -> FileEncodeResult {
793+
if let Some(data) = &self.data {
794+
data.current.encoder.steal().finish(profiler)
795+
} else {
796+
Ok(())
797+
}
794798
}
795799

796800
fn next_virtual_depnode_index(&self) -> DepNodeIndex {

compiler/rustc_query_system/src/dep_graph/serialized.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ impl<K: DepKind + Encodable<FileEncoder>> GraphEncoder<K> {
304304
self.status.lock().encode_node(&node, &self.record_graph)
305305
}
306306

307-
pub fn finish(self) -> FileEncodeResult {
307+
pub fn finish(self, profiler: &SelfProfilerRef) -> FileEncodeResult {
308+
let _prof_timer = profiler.generic_activity("incr_comp_encode_dep_graph");
308309
self.status.into_inner().finish()
309310
}
310311
}

0 commit comments

Comments
 (0)