Recursively insert a callee node and its descendants
(parent: &mut FlameGraphNode, node: &FlameGraphNode)
| 1055 | |
| 1056 | /// Recursively insert a callee node and its descendants |
| 1057 | fn insert_callee_node(parent: &mut FlameGraphNode, node: &FlameGraphNode) { |
| 1058 | // Find or create child with this frame_id |
| 1059 | let child = if let Some(existing) = parent.children.iter_mut().find(|x| x.id == node.id) { |
| 1060 | existing.weight += node.weight; |
| 1061 | existing |
| 1062 | } else { |
| 1063 | parent.children.push(FlameGraphNode { |
| 1064 | weight: node.weight, |
| 1065 | fg_color: node.fg_color, |
| 1066 | bg_color: node.bg_color, |
| 1067 | id: node.id, |
| 1068 | text: node.text.clone(), |
| 1069 | inline_skip: node.inline_skip, |
| 1070 | children: vec![], |
| 1071 | }); |
| 1072 | parent.children.last_mut().unwrap() |
| 1073 | }; |
| 1074 | |
| 1075 | // Recursively add all descendants |
| 1076 | for grandchild in &node.children { |
| 1077 | insert_callee_node(child, grandchild); |
| 1078 | } |
| 1079 | } |
no outgoing calls
no test coverage detected