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

fix division per zero in profile mode.

上级 495ce777
......@@ -187,7 +187,11 @@ class ProfileMode(Mode):
for f,t,a,nb_call in atimes[:n_apply_to_print]:
tot+=t
ftot=tot*100/local_time
print ' %4.1f%% %5.1f%% %5.3fs %5.3fs %.2es %i %i %s' % (f, ftot, t, tot, t/nb_call,nb_call, a[0], str(a[1]))
if nb_call==0:
time_per_call = float('nan')
else:
time_per_call = t/nb_call
print ' %4.1f%% %5.1f%% %5.3fs %5.3fs %.2es %i %i %s' % (f, ftot, t, tot, time_per_call,nb_call, a[0], str(a[1]))
print ' ... (remaining %i Apply instances account for %.2f%%(%.2fs) of the runtime)'\
%(max(0, len(atimes)-n_apply_to_print),
sum(f for f, t, a, nb_call in atimes[n_apply_to_print:]),
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论