(self, allocs, dedup, nodes_by_path=None)
| 199 | node.zero() |
| 200 | |
| 201 | def diff(self, allocs, dedup, nodes_by_path=None): |
| 202 | if nodes_by_path is None: |
| 203 | nodes_by_path = {} |
| 204 | |
| 205 | path = dedup(self.path()) |
| 206 | if path in nodes_by_path: |
| 207 | last = nodes_by_path[path][-1] |
| 208 | nodes_by_path[path].append(self) |
| 209 | # Temporarily put in "missing" nodes |
| 210 | our_nodes = set([n.text for n in self.nodes]) |
| 211 | for node in last.nodes: |
| 212 | if node.text not in our_nodes: |
| 213 | copy = Node(copy=node) |
| 214 | copy.zero() |
| 215 | self.nodes.append(copy) |
| 216 | change = self.total - last.total |
| 217 | else: |
| 218 | last = None |
| 219 | nodes_by_path[path] = [self] |
| 220 | change = self.total |
| 221 | |
| 222 | if not allocs: |
| 223 | change = -change |
| 224 | self.value = 0 if change < 0 else change |
| 225 | |
| 226 | self.process(Node.diff, allocs, dedup, nodes_by_path) |
| 227 | |
| 228 | if self.is_section(): |
| 229 | # heap_tree must be set based on if there are child nodes or not or |
| 230 | # else the parser in the visualizer will fail. |
| 231 | self.props['heap_tree'] = 'detailed' if self.nodes else 'empty' |
| 232 | self.value = self.sum_values() |
| 233 | |
| 234 | if self.value == 0 and last is not None and last.value == 0: |
| 235 | # Remove nodes with 0 total size |
| 236 | if self.is_section() or self.is_heap_node(): |
| 237 | return [self] |
| 238 | return [] |
| 239 | elif not self.is_root(): |
| 240 | return [self] |
| 241 | |
| 242 | |
| 243 | def add_node(stack, level, text): |
no test coverage detected