我正在使用Python (v2.4)的profile
模块来分析一个numpy
脚本,以下记录似乎占用了大部分执行时间:
ncalls tottime percall cumtime percall filename:lineno(function)
256/1 0.000 0.000 7.710 7.710 <string>:1(?)
不幸的是,它的外观使得在谷歌上很难找到。
我该如何确定这到底是什么?
编辑 通过以下方式从shell中运行分析器:python -m profile -s cumulative script.py
profile.run()
来运行分析器?那么<string>:1
指的是你传递给该函数的语句字符串的第一行。如果您以不同的方式调用分析器,请指定。 - Sven Marnach