Skip to content

Commit

Permalink
Also profile finishing the encoding.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Mar 30, 2021
1 parent df24315 commit 8ee9322
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_incremental/src/persist/save.rs
Expand Up @@ -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(),
Expand Down
8 changes: 6 additions & 2 deletions compiler/rustc_query_system/src/dep_graph/graph.rs
Expand Up @@ -789,8 +789,12 @@ impl<K: DepKind> DepGraph<K> {
}
}

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 {
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_query_system/src/dep_graph/serialized.rs
Expand Up @@ -304,7 +304,8 @@ impl<K: DepKind + Encodable<FileEncoder>> GraphEncoder<K> {
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()
}
}

0 comments on commit 8ee9322

Please sign in to comment.