[incremental] Collect stats about duplicated edge reads from queries
Part of #45873
This commit is contained in:
parent
aabfed5e0c
commit
f726634198
2 changed files with 17 additions and 0 deletions
|
@ -413,6 +413,12 @@ impl DepGraph {
|
||||||
self.data.as_ref().and_then(|t| t.dep_node_debug.borrow().get(&dep_node).cloned())
|
self.data.as_ref().and_then(|t| t.dep_node_debug.borrow().get(&dep_node).cloned())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn edge_deduplication_data(&self) -> (u64, u64) {
|
||||||
|
let current_dep_graph = self.data.as_ref().unwrap().current.borrow();
|
||||||
|
|
||||||
|
(current_dep_graph.total_read_count, current_dep_graph.total_duplicate_read_count)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn serialize(&self) -> SerializedDepGraph {
|
pub fn serialize(&self) -> SerializedDepGraph {
|
||||||
let fingerprints = self.fingerprints.borrow();
|
let fingerprints = self.fingerprints.borrow();
|
||||||
let current_dep_graph = self.data.as_ref().unwrap().current.borrow();
|
let current_dep_graph = self.data.as_ref().unwrap().current.borrow();
|
||||||
|
@ -737,6 +743,9 @@ pub(super) struct CurrentDepGraph {
|
||||||
// each anon node. The session-key is just a random number generated when
|
// each anon node. The session-key is just a random number generated when
|
||||||
// the DepGraph is created.
|
// the DepGraph is created.
|
||||||
anon_id_seed: Fingerprint,
|
anon_id_seed: Fingerprint,
|
||||||
|
|
||||||
|
total_read_count: u64,
|
||||||
|
total_duplicate_read_count: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CurrentDepGraph {
|
impl CurrentDepGraph {
|
||||||
|
@ -770,6 +779,8 @@ impl CurrentDepGraph {
|
||||||
anon_id_seed: stable_hasher.finish(),
|
anon_id_seed: stable_hasher.finish(),
|
||||||
task_stack: Vec::new(),
|
task_stack: Vec::new(),
|
||||||
forbidden_edge,
|
forbidden_edge,
|
||||||
|
total_read_count: 0,
|
||||||
|
total_duplicate_read_count: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -900,6 +911,7 @@ impl CurrentDepGraph {
|
||||||
ref mut read_set,
|
ref mut read_set,
|
||||||
node: ref target,
|
node: ref target,
|
||||||
}) => {
|
}) => {
|
||||||
|
self.total_read_count += 1;
|
||||||
if read_set.insert(source) {
|
if read_set.insert(source) {
|
||||||
reads.push(source);
|
reads.push(source);
|
||||||
|
|
||||||
|
@ -913,6 +925,8 @@ impl CurrentDepGraph {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
self.total_duplicate_read_count += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(&mut OpenTask::Anon {
|
Some(&mut OpenTask::Anon {
|
||||||
|
|
|
@ -189,6 +189,7 @@ fn encode_dep_graph(tcx: TyCtxt,
|
||||||
|
|
||||||
let total_node_count = serialized_graph.nodes.len();
|
let total_node_count = serialized_graph.nodes.len();
|
||||||
let total_edge_count = serialized_graph.edge_list_data.len();
|
let total_edge_count = serialized_graph.edge_list_data.len();
|
||||||
|
let (total_edge_reads, total_duplicate_edge_reads) = tcx.dep_graph.edge_deduplication_data();
|
||||||
|
|
||||||
let mut counts: FxHashMap<_, Stat> = FxHashMap();
|
let mut counts: FxHashMap<_, Stat> = FxHashMap();
|
||||||
|
|
||||||
|
@ -226,6 +227,8 @@ fn encode_dep_graph(tcx: TyCtxt,
|
||||||
println!("[incremental]");
|
println!("[incremental]");
|
||||||
println!("[incremental] Total Node Count: {}", total_node_count);
|
println!("[incremental] Total Node Count: {}", total_node_count);
|
||||||
println!("[incremental] Total Edge Count: {}", total_edge_count);
|
println!("[incremental] Total Edge Count: {}", total_edge_count);
|
||||||
|
println!("[incremental] Total Edge Reads: {}", total_edge_reads);
|
||||||
|
println!("[incremental] Total Duplicate Edge Reads: {}", total_duplicate_edge_reads);
|
||||||
println!("[incremental]");
|
println!("[incremental]");
|
||||||
println!("[incremental] {:<36}| {:<17}| {:<12}| {:<17}|",
|
println!("[incremental] {:<36}| {:<17}| {:<12}| {:<17}|",
|
||||||
"Node Kind",
|
"Node Kind",
|
||||||
|
|
Loading…
Reference in a new issue