# Unused line numbers required by kcachegrind.
POS = '1'
def nameFromNode(tree):
name = tree['name']
pos = tree['pos']
if pos.endswith(": "):
pos = pos[:-2]
return (name, pos)
def addFuncNames(tree, s):
s.add(nameFromNode(tree))
for child in tree['children']:
addFuncNames(child, s)
def funcNames(tree):
s = set()
addFuncNames(tree, s)
return s
def computeTotals(tree):
for child in tree['children']:
computeTotals(child)
tree['instTotal'] = (tree['instructions']
+ sum(child['instTotal'] for child in tree['children']))
tree['nsecsTotal'] = (tree['nsecs']
+ sum(child['nsecsTotal'] for child in tree['children']))