From 421a9b258ec0ec305196cbd62eb2f5253c3ddc3f Mon Sep 17 00:00:00 2001 From: akvlad Date: Fri, 18 Oct 2024 16:17:41 +0300 Subject: [PATCH] diff_tree debug --- pyroscope/pprof-bin/src/lib.rs | 4 +++- pyroscope/pprof-bin/src/utest.rs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pyroscope/pprof-bin/src/lib.rs b/pyroscope/pprof-bin/src/lib.rs index deb53196..7f397658 100644 --- a/pyroscope/pprof-bin/src/lib.rs +++ b/pyroscope/pprof-bin/src/lib.rs @@ -582,7 +582,9 @@ fn synchronize_names(t1: &mut Tree, t2: &mut Tree) { } fn merge_nodes(t1: &mut Tree, t2: &mut Tree) { - let keys: Vec = t1.nodes.keys().cloned().collect(); + let mut keys: HashSet = HashSet::new(); + keys.extend(t1.nodes.keys()); + keys.extend(t2.nodes.keys()); for key in keys { let t1_children = t1.nodes.entry(key).or_insert_with(Vec::new); diff --git a/pyroscope/pprof-bin/src/utest.rs b/pyroscope/pprof-bin/src/utest.rs index 57fee35c..0efef076 100644 --- a/pyroscope/pprof-bin/src/utest.rs +++ b/pyroscope/pprof-bin/src/utest.rs @@ -144,7 +144,7 @@ mod tests { for j in 0..exp_res.levels[i].values.len() / 7 { exp_level.push(exp_res.names[exp_res.levels[i].values[j * 7 + 6] as usize].clone()) } - for j in 0..o_res.levels[i].values.len() / 6 { + for j in 0..o_res.levels[i].values.len() / 7 { res_level.push(o_res.names[o_res.levels[i].values[j * 7 + 6] as usize].clone()) } exp_level.sort();