【发布时间】:2017-03-17 04:27:24
【问题描述】:
我正在使用 cProfile 和以下命令分析一个 python 脚本main.py:
python -m cProfile -s tottime main.py
我得到的输出是(仅复制粘贴输出的顶行):
10184337 function calls (10181667 primitive calls) in 13.597 seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
1 4.674 4.674 13.598 13.598 main.py:2(<module>)
2142 2.964 0.001 4.663 0.002 load_aerdat3.py:61(getPacket)
459 2.381 0.005 2.381 0.005 {waitKey}
1667989 1.170 0.000 1.170 0.000 {numpy.core.multiarray.array}
...
tottime (4.674) 与 cumtime (13.598) 的 main.py 有何不同,因为这个函数(即整个脚本)只调用一次?
【问题讨论】: