提交 b4e1cbdd authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Fix all the sorts so that they will work on python 3.

上级 4343009e
...@@ -364,8 +364,7 @@ class ProfileStats(object): ...@@ -364,8 +364,7 @@ class ProfileStats(object):
class_call.get(clas, 0), class_call.get(clas, 0),
class_apply.get(clas, 0)) class_apply.get(clas, 0))
for clas, t in class_time.items()] for clas, t in class_time.items()]
otimes.sort() otimes.sort(key=lambda t: (t[1], t[4], t[5]), reverse=True)
otimes.reverse()
tot = 0 tot = 0
print >> file, 'Class' print >> file, 'Class'
print >> file, '---' print >> file, '---'
...@@ -447,8 +446,7 @@ class ProfileStats(object): ...@@ -447,8 +446,7 @@ class ProfileStats(object):
op_call.get(op, 0), op_call.get(op, 0),
op_apply.get(op, 0)) op_apply.get(op, 0))
for op, t in op_time.items()] for op, t in op_time.items()]
otimes.sort() otimes.sort(key=lambda t: (t[1], t[4], t[5]), reverse=True)
otimes.reverse()
tot = 0 tot = 0
print >> file, 'Ops' print >> file, 'Ops'
print >> file, '---' print >> file, '---'
...@@ -1151,8 +1149,7 @@ class ProfileStats(object): ...@@ -1151,8 +1149,7 @@ class ProfileStats(object):
" <Apply node>") " <Apply node>")
print >> file, "" print >> file, ""
items = node_mem.items() items = node_mem.items()
items.sort(key=lambda a: a[1]) items.sort(key=lambda a: a[1], reverse=True)
items.reverse()
for idx, (node, node_outputs_size) in enumerate(items[:N]): for idx, (node, node_outputs_size) in enumerate(items[:N]):
code = ['c'] * len(node.outputs) code = ['c'] * len(node.outputs)
for out, inp in getattr(node.op, 'destroy_map', {}).iteritems(): for out, inp in getattr(node.op, 'destroy_map', {}).iteritems():
...@@ -1257,8 +1254,7 @@ if 0: # old code still to be ported from ProfileMode ...@@ -1257,8 +1254,7 @@ if 0: # old code still to be ported from ProfileMode
print '\nSingle Op-wise summary: <% of local_time spent on this kind of Op> <cumulative %%> <self seconds> <cumulative seconds> <time per call> <nb_call> <nb_op> <nb_op> <Op name>' print '\nSingle Op-wise summary: <% of local_time spent on this kind of Op> <cumulative %%> <self seconds> <cumulative seconds> <time per call> <nb_call> <nb_op> <nb_op> <Op name>'
sotimes = [(t * 100 / local_time, t, a, sop_c[a], sotimes = [(t * 100 / local_time, t, a, sop_c[a],
sop_call[a], sop_op[a]) for a, t in sop_time.items()] sop_call[a], sop_op[a]) for a, t in sop_time.items()]
sotimes.sort() sotimes.sort(key=lambda t: (t[1], t[4], t[5]), reverse=True)
sotimes.reverse()
tot = 0 tot = 0
for f, t, a, ci, nb_call, nb_op in sotimes[:n_ops_to_print]: for f, t, a, ci, nb_call, nb_op in sotimes[:n_ops_to_print]:
if nb_call == 0: if nb_call == 0:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论