提交 e585d3f6 authored 作者: Frederic Bastien's avatar Frederic Bastien

small modif. Not print if the op is in c in the type-op-wise summary.

上级 32f639d7
...@@ -85,16 +85,20 @@ class ProfileMode(Mode): ...@@ -85,16 +85,20 @@ class ProfileMode(Mode):
sop_time={} sop_time={}
sop_c={}
for a,t in op_time.items(): for a,t in op_time.items():
sop_time.setdefault(type(a),0) sop_time.setdefault(type(a),0)
sop_time[type(a)]+=t sop_time[type(a)]+=t
if sop_c.has_key(type(a)):
assert sop_c[type(a)]==self.op_cimpl[a]
else:
sop_c[type(a)]=self.op_cimpl[a]
print '\nSingle Op-wise summary: <% of local_time spent on this kind of Op> <cumulative seconds> <self seconds> <Op name>' print '\nSingle Op-wise summary: <% of local_time spent on this kind of Op> <cumulative seconds> <self seconds> <Op name>'
sotimes = [(t/local_time, t, a) for a, t in sop_time.items()] sotimes = [(t/local_time, t, a, sop_c[a]) for a, t in sop_time.items()]
sotimes.sort() sotimes.sort()
sotimes.reverse() sotimes.reverse()
tot=0 tot=0
for f,t,a in sotimes[:n_ops_to_print]: for f,t,a,ci in sotimes[:n_ops_to_print]:
tot+=t tot+=t
print ' %.2f%% %.3fs %.3fs %s %s' % (f*100, tot, t, '*' if ci else ' ', a) print ' %.2f%% %.3fs %.3fs %s %s' % (f*100, tot, t, '*' if ci else ' ', a)
print ' ... (remaining %i Ops account for %.2f%%(%.2fs) of the runtime)'\ print ' ... (remaining %i Ops account for %.2f%%(%.2fs) of the runtime)'\
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论