提交 ea83daac authored 作者: Mohammad Pezeshki's avatar Mohammad Pezeshki

fucntion compute_total_times became more efficient.

上级 57e6ab6d
......@@ -295,17 +295,19 @@ class ProfileStats(object):
return rval
def fill_node_total_time(self, node, total_times):
if node not in total_times.keys():
total = self.apply_time[node]
for parent in node.get_parents():
if parent.owner in self.apply_time.keys():
total += self.get_node_total_time(parent.owner)
total_times[node] = total
total = self.apply_time[node]
for parent in node.get_parents():
if parent.owner in self.apply_time.keys():
if parent.owner not in total_times.keys():
self.fill_node_total_time(parent.owner, total_times)
total += total_times[parent.owner]
total_times[node] = total
def compute_total_times(self):
rval = {}
for node in self.apply_time.keys():
self.fill_node_total_time(node, rval)
if node not in rval:
self.fill_node_total_time(node, rval)
return rval
def op_callcount(self):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论