MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / diff

Method diff

tools/scripts/massif-diff.py:201–240  ·  view source on GitHub ↗
(self, allocs, dedup, nodes_by_path=None)

Source from the content-addressed store, hash-verified

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
243def add_node(stack, level, text):

Callers 1

write_diffFunction · 0.95

Calls 11

pathMethod · 0.95
zeroMethod · 0.95
processMethod · 0.95
is_sectionMethod · 0.95
sum_valuesMethod · 0.95
is_heap_nodeMethod · 0.95
is_rootMethod · 0.95
dedupFunction · 0.85
setFunction · 0.85
NodeClass · 0.70
appendMethod · 0.45

Tested by

no test coverage detected