【发布时间】:2011-10-27 12:54:06
【问题描述】:
我运行这个:
In [303]: %prun my_function()
384707 function calls (378009 primitive calls) in 83.116 CPU seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
37706 41.693 0.001 41.693 0.001 {max}
20039 36.000 0.002 36.000 0.002 {min}
18835 1.848 0.000 2.208 0.000 helper.py:119(fftfreq)
--剪辑--
tottime、percall、cumtime 分别是什么? ncalls 相当明显(函数被调用的次数)。我的猜测是 tottime 是在函数中花费的总时间,不包括在它自己的函数调用中花费的时间; percall 是 ???; cumtime 是在函数调用中花费的总时间,包括在它自己的函数调用中花费的时间(当然,不包括重复计算)。 docs 不太有用;谷歌搜索也无济于事。
【问题讨论】:
标签: python interpreter profiler ipython